[migration] don't add CWUniqueConstraint if already there (may occurs when running a migration in multiple times stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 22 Jun 2011 16:34:27 +0200
branchstable
changeset 7549 465009397d91
parent 7546 7f321b7db8da
child 7550 183a61d1bab9
[migration] don't add CWUniqueConstraint if already there (may occurs when running a migration in multiple times
misc/migration/bootstrapmigration_repository.py
--- a/misc/migration/bootstrapmigration_repository.py	Tue Jun 21 15:34:15 2011 +0200
+++ b/misc/migration/bootstrapmigration_repository.py	Wed Jun 22 16:34:27 2011 +0200
@@ -1,4 +1,4 @@
-# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
 #
 # This file is part of CubicWeb.
@@ -94,7 +94,7 @@
             drop_relation_definition('CWRType', '%s_permission' % action, 'RQLExpression')
     sync_schema_props_perms('read_permission', syncperms=False) # fix read_permission cardinality
 
-if applcubicwebversion < (3, 9, 6) and cubicwebversion >= (3, 9, 6):
+if applcubicwebversion < (3, 9, 6) and cubicwebversion >= (3, 9, 6) and not 'CWUniqueTogetherConstraint' in schema:
     add_entity_type('CWUniqueTogetherConstraint')
 
 if not ('CWUniqueTogetherConstraint', 'CWRType') in schema['relations'].rdefs: