use Table._columns to remove columns (addresses #112)
- add SQLA_07 predicate in migrate/changeset/__init__.py - use Table._columns instead of Table.c when removing columns in migrate/changeset/schema.py
This commit is contained in:
parent
97d89e357a
commit
e11a9e5cba
@ -14,6 +14,7 @@ warnings.simplefilter('always', DeprecationWarning)
|
|||||||
|
|
||||||
_sa_version = tuple(int(re.match("\d+", x).group(0)) for x in _sa_version.split("."))
|
_sa_version = tuple(int(re.match("\d+", x).group(0)) for x in _sa_version.split("."))
|
||||||
SQLA_06 = _sa_version >= (0, 6)
|
SQLA_06 = _sa_version >= (0, 6)
|
||||||
|
SQLA_07 = _sa_version >= (0, 7)
|
||||||
|
|
||||||
del re
|
del re
|
||||||
del _sa_version
|
del _sa_version
|
||||||
|
@ -11,7 +11,7 @@ from sqlalchemy.schema import ForeignKeyConstraint
|
|||||||
from sqlalchemy.schema import UniqueConstraint
|
from sqlalchemy.schema import UniqueConstraint
|
||||||
|
|
||||||
from migrate.exceptions import *
|
from migrate.exceptions import *
|
||||||
from migrate.changeset import SQLA_06
|
from migrate.changeset import SQLA_06, SQLA_07
|
||||||
from migrate.changeset.databases.visitor import (get_engine_visitor,
|
from migrate.changeset.databases.visitor import (get_engine_visitor,
|
||||||
run_single_visitor)
|
run_single_visitor)
|
||||||
|
|
||||||
@ -590,7 +590,10 @@ populated with defaults
|
|||||||
table.constraints = table.constraints - to_drop
|
table.constraints = table.constraints - to_drop
|
||||||
|
|
||||||
if table.c.contains_column(self):
|
if table.c.contains_column(self):
|
||||||
table.c.remove(self)
|
if SQLA_07:
|
||||||
|
table._columns.remove(self)
|
||||||
|
else:
|
||||||
|
table.c.remove(self)
|
||||||
|
|
||||||
# TODO: this is fixed in 0.6
|
# TODO: this is fixed in 0.6
|
||||||
def copy_fixed(self, **kw):
|
def copy_fixed(self, **kw):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user