Commits

Mike Bayer committed 3a8e4e8

- [bug] Fixed support of schema-qualified
ForeignKey target in column alter operations,
courtesy Alexander Kolov.

  • Participants
  • Parent commits 29e2b54

Comments (0)

Files changed (3)

 - [feature] Added support for UniqueConstraint
   in autogenerate, courtesy Atsushi Odagiri
 
+- [bug] Fixed support of schema-qualified 
+  ForeignKey target in column alter operations,
+  courtesy Alexander Kolov.
+
 0.3.1
 =====
 - [bug] bulk_insert() fixes:
     pass
 
 from sqlalchemy import __version__
-_vers = tuple([int(x) for x in __version__.split(".")])
+def _safe_int(value):
+    try:
+        return int(value)
+    except:
+        return 0
+_vers = tuple([_safe_int(x) for x in __version__.split(".")])
 sqla_06 = _vers > (0, 6)
 sqla_07 = _vers > (0, 7)
 if not sqla_06:
         "ALTER TABLE t1 ADD FOREIGN KEY(c1) REFERENCES t1 (c2)"
     )
 
+def test_add_column_fk_schema():
+    context = op_fixture()
+    op.add_column('t1', Column('c1', Integer, ForeignKey('remote.t2.c2'), nullable=False))
+    context.assert_(
+    'ALTER TABLE t1 ADD COLUMN c1 INTEGER NOT NULL', 
+    'ALTER TABLE t1 ADD FOREIGN KEY(c1) REFERENCES remote.t2 (c2)'
+    )
+
 def test_drop_column():
     context = op_fixture()
     op.drop_column('t1', 'c1')