misc/migration/3.10.7_Any.py
author Sylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 20 Jan 2011 08:23:27 +0100
branchstable
changeset 6852 970d1aab42a1
parent 6815 a84190d4e78c
child 6896 784d5df35af1
permissions -rw-r--r--
[migration] fix migration of old cw instances which do not have yet the CWUniqueTogetherConstraint entity type
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6852
970d1aab42a1 [migration] fix migration of old cw instances which do not have yet the CWUniqueTogetherConstraint entity type
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6815
diff changeset
     1
if not ('CWUniqueTogetherConstraint', 'CWRType') in schema['relations'].rdefs:
970d1aab42a1 [migration] fix migration of old cw instances which do not have yet the CWUniqueTogetherConstraint entity type
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6815
diff changeset
     2
    add_relation_definition('CWUniqueTogetherConstraint', 'relations', 'CWRType')
970d1aab42a1 [migration] fix migration of old cw instances which do not have yet the CWUniqueTogetherConstraint entity type
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6815
diff changeset
     3
    rql('SET C relations RT WHERE C relations RDEF, RDEF relation_type RT')
970d1aab42a1 [migration] fix migration of old cw instances which do not have yet the CWUniqueTogetherConstraint entity type
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6815
diff changeset
     4
    commit()
970d1aab42a1 [migration] fix migration of old cw instances which do not have yet the CWUniqueTogetherConstraint entity type
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6815
diff changeset
     5
    drop_relation_definition('CWUniqueTogetherConstraint', 'relations', 'CWAttribute')
970d1aab42a1 [migration] fix migration of old cw instances which do not have yet the CWUniqueTogetherConstraint entity type
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6815
diff changeset
     6
    drop_relation_definition('CWUniqueTogetherConstraint', 'relations', 'CWRelation')
6815
a84190d4e78c [schema] fix pb with ambiguous relation used within UniqueTogetherConstraint by having CWUniqueTogetherConstraint.relation targeting CWRType instead of CWAttribute/CWRelation. This fixes 3.10.7 migration.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6757
diff changeset
     7
6757
bc878ec35794 #1382705 forbid with sql level locking the simultaneous fireing of a transition on a given entity
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents:
diff changeset
     8
add_attribute('TrInfo', 'tr_count')
bc878ec35794 #1382705 forbid with sql level locking the simultaneous fireing of a transition on a given entity
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents:
diff changeset
     9
sync_schema_props_perms('TrInfo')