custom cache code is portable and now within
"caching_query.py". This allows the example to
be easier to "drop in" to existing projects.
+
+ - the history_meta versioning recipe sets "unique=False"
+ when copying columns, so that the versioning
+ table handles multiple rows with repeating values.
+ [ticket:1887]
0.6.3
=====
continue
col = column.copy()
+ col.unique = False
if super_mapper and col_references_table(column, super_mapper.local_table):
super_fks.append((col.key, list(super_history_mapper.base_mapper.local_table.primary_key)[0]))
for obj in versioned_objects(session.dirty):
create_version(obj, session)
for obj in versioned_objects(session.deleted):
- create_version(obj, session, deleted = True)
-
+ create_version(obj, session, deleted = True)
\ No newline at end of file
SubClassHistory(id=2, name=u's1', type=u'sub', version=1)
]
)
+
+ def test_unique(self):
+ class SomeClass(Base, ComparableEntity):
+ __tablename__ = 'sometable'
+
+ id = Column(Integer, primary_key=True)
+ name = Column(String(50), unique=True)
+ data = Column(String(50))
+
+ self.create_tables()
+ sess = Session()
+ sc = SomeClass(name='sc1', data='sc1')
+ sess.add(sc)
+ sess.commit()
+
+ sc.data = 'sc1modified'
+ sess.commit()
+
+ assert sc.version == 2
+
+ sc.data = 'sc1modified2'
+ sess.commit()
+ assert sc.version == 3