mirror of
https://github.com/djrobstep/migra.git
synced 2024-09-11 05:45:51 +03:00
refmt
This commit is contained in:
parent
2c38e8c483
commit
3ff01951b2
@ -122,7 +122,7 @@ def statements_from_differences(
|
|||||||
for k, v in added.items():
|
for k, v in added.items():
|
||||||
if not has_uncreated_dependencies(v, pending_creations):
|
if not has_uncreated_dependencies(v, pending_creations):
|
||||||
if k in pending_creations:
|
if k in pending_creations:
|
||||||
if hasattr(v, 'safer_create_statements'):
|
if hasattr(v, "safer_create_statements"):
|
||||||
statements += v.safer_create_statements
|
statements += v.safer_create_statements
|
||||||
else:
|
else:
|
||||||
statements.append(v.create_statement)
|
statements.append(v.create_statement)
|
||||||
@ -137,7 +137,7 @@ def statements_from_differences(
|
|||||||
if creations:
|
if creations:
|
||||||
if not has_uncreated_dependencies(v, pending_creations):
|
if not has_uncreated_dependencies(v, pending_creations):
|
||||||
if k in pending_creations:
|
if k in pending_creations:
|
||||||
if hasattr(v, 'safer_create_statements'):
|
if hasattr(v, "safer_create_statements"):
|
||||||
statements += v.safer_create_statements
|
statements += v.safer_create_statements
|
||||||
else:
|
else:
|
||||||
statements.append(v.create_statement)
|
statements.append(v.create_statement)
|
||||||
|
@ -4,8 +4,6 @@ import argparse
|
|||||||
import sys
|
import sys
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
from .migra import Migration
|
from .migra import Migration
|
||||||
from .statements import UnsafeMigrationException
|
from .statements import UnsafeMigrationException
|
||||||
|
|
||||||
@ -17,6 +15,7 @@ def arg_context(x):
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
from sqlbag import S
|
from sqlbag import S
|
||||||
|
|
||||||
with S(x) as s:
|
with S(x) as s:
|
||||||
yield s
|
yield s
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ from __future__ import unicode_literals
|
|||||||
|
|
||||||
from schemainspect import DBInspector, get_inspector
|
from schemainspect import DBInspector, get_inspector
|
||||||
|
|
||||||
|
|
||||||
from .changes import Changes
|
from .changes import Changes
|
||||||
from .statements import Statements
|
from .statements import Statements
|
||||||
|
|
||||||
@ -60,6 +59,7 @@ class Migration(object):
|
|||||||
|
|
||||||
def apply(self):
|
def apply(self):
|
||||||
from sqlbag import raw_execute
|
from sqlbag import raw_execute
|
||||||
|
|
||||||
for stmt in self.statements:
|
for stmt in self.statements:
|
||||||
raw_execute(self.s_from, stmt)
|
raw_execute(self.s_from, stmt)
|
||||||
self.changes.i_from = get_inspector(
|
self.changes.i_from = get_inspector(
|
||||||
|
Loading…
Reference in New Issue
Block a user