]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- Fixed bug in history_meta.py example where
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 17 Oct 2011 17:26:26 +0000 (13:26 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 17 Oct 2011 17:26:26 +0000 (13:26 -0400)
the "unique" flag was not removed from a
single-table-inheritance subclass which
generates columns to put up onto the base.

CHANGES
examples/versioning/history_meta.py
examples/versioning/test_versioning.py
lib/sqlalchemy/__init__.py

diff --git a/CHANGES b/CHANGES
index f18854abdf66d35fef4187a9c78255ea39ef752c..4807a39d1d2902f1a2b7c707bee6410d34d1be0c 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -3,6 +3,14 @@
 =======
 CHANGES
 =======
+0.7.4
+=====
+- examples
+   - Fixed bug in history_meta.py example where
+     the "unique" flag was not removed from a 
+     single-table-inheritance subclass which 
+     generates columns to put up onto the base.
+
 0.7.3
 =====
 - general
index 5f3820f68005aa57f4d2ab2f95fbd9239fd44902..9544451eecd2d3611074c61f643d6e30ee7b9f2e 100644 (file)
@@ -60,6 +60,7 @@ def _history_mapper(local_mapper):
         for column in local_mapper.local_table.c:
             if column.key not in super_history_mapper.local_table.c:
                 col = column.copy()
+                col.unique = False
                 super_history_mapper.local_table.append_column(col)
         table = None
 
index 5baf09530c3f67c360556aa667a0bfcd1e978ec6..d91f12037a18a56c80c854d88d156d57f348586f 100644 (file)
@@ -228,7 +228,7 @@ class TestVersioning(TestCase):
 
         class SubClass(BaseClass):
 
-            subname = Column(String(50))
+            subname = Column(String(50), unique=True)
             __mapper_args__ = {'polymorphic_identity':'sub'}
 
         self.create_tables()
@@ -263,6 +263,11 @@ class TestVersioning(TestCase):
             ]
         )
 
+        # test the unique constraint on the subclass
+        # column
+        sc.name ="modifyagain"
+        sess.flush()
+
     def test_unique(self):
         class SomeClass(Versioned, Base, ComparableEntity):
             __tablename__ = 'sometable'
index 0b9b7a00e9f11440ae956ef989b42c78c0cf98b0..aa303e85cfcd1308170c01a8b97c6dddab0e96d8 100644 (file)
@@ -117,7 +117,7 @@ from sqlalchemy.engine import create_engine, engine_from_config
 __all__ = sorted(name for name, obj in locals().items()
                  if not (name.startswith('_') or inspect.ismodule(obj)))
 
-__version__ = '0.7.3'
+__version__ = '0.7.4'
 
 del inspect, sys