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:
Jan Dittberner 2011-05-25 15:29:28 +02:00
parent 97d89e357a
commit e11a9e5cba
2 changed files with 6 additions and 2 deletions

View File

@ -14,6 +14,7 @@ warnings.simplefilter('always', DeprecationWarning)
_sa_version = tuple(int(re.match("\d+", x).group(0)) for x in _sa_version.split("."))
SQLA_06 = _sa_version >= (0, 6)
SQLA_07 = _sa_version >= (0, 7)
del re
del _sa_version

View File

@ -11,7 +11,7 @@ from sqlalchemy.schema import ForeignKeyConstraint
from sqlalchemy.schema import UniqueConstraint
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,
run_single_visitor)
@ -590,7 +590,10 @@ populated with defaults
table.constraints = table.constraints - to_drop
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
def copy_fixed(self, **kw):