summaryrefslogtreecommitdiff
path: root/migrate
diff options
context:
space:
mode:
authorJan Dittberner <jan.dittberner@googlemail.com>2011-05-25 15:29:28 +0200
committerJan Dittberner <jan.dittberner@googlemail.com>2011-05-25 15:29:28 +0200
commite11a9e5cbaeb76fae1ed1d9b3614568be2520d92 (patch)
tree4663d03d466798b587844c7e253408acbcb6128f /migrate
parent97d89e357a8d1838d9bef8e3f5c39f07bf0ca7eb (diff)
downloadsqalchemy-migrate-e11a9e5cbaeb76fae1ed1d9b3614568be2520d92.tar.gz
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
Diffstat (limited to 'migrate')
-rw-r--r--migrate/changeset/__init__.py1
-rw-r--r--migrate/changeset/schema.py7
2 files changed, 6 insertions, 2 deletions
diff --git a/migrate/changeset/__init__.py b/migrate/changeset/__init__.py
index 7a12643..fa3387d 100644
--- a/migrate/changeset/__init__.py
+++ b/migrate/changeset/__init__.py
@@ -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
diff --git a/migrate/changeset/schema.py b/migrate/changeset/schema.py
index 75cd3fd..1bd3fc0 100644
--- a/migrate/changeset/schema.py
+++ b/migrate/changeset/schema.py
@@ -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):