misc/migration/bootstrapmigration_repository.py
changeset 3890 d7a270f50f54
parent 3395 405f393bcac0
parent 3788 3d5abcd7c852
child 4011 394f853bb653
--- a/misc/migration/bootstrapmigration_repository.py	Sun Nov 08 21:53:18 2009 +0100
+++ b/misc/migration/bootstrapmigration_repository.py	Fri Nov 20 19:35:54 2009 +0100
@@ -28,6 +28,17 @@
     session.set_shared_data('do-not-insert-cwuri', False)
 
 if applcubicwebversion < (3, 5, 0) and cubicwebversion >= (3, 5, 0):
+    # check that migration is not doomed
+    rset = rql('Any X,Y WHERE X transition_of E, Y transition_of E, '
+               'X name N, Y name N, NOT X identity Y',
+               ask_confirm=False)
+    if rset:
+        from logilab.common.shellutils import ASK
+        if not ASK.confirm('Migration will fail because of transitions with the same name. '
+                           'Continue anyway ?'):
+            import sys
+            sys.exit(1)
+    # proceed with migration
     add_entity_type('Workflow')
     add_entity_type('BaseTransition')
     add_entity_type('WorkflowTransition')