[migration] Tweak migration to avoid being asked for too much confirmation
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 19 Jan 2017 10:26:56 +0100
changeset 2305 2b90e9d9e10d
parent 2304 af46a867519d
child 2306 eae2ee93bae4
[migration] Tweak migration to avoid being asked for too much confirmation
__pkginfo__.py
migration/0.6.0_Any.py
--- a/__pkginfo__.py	Wed Jan 18 15:35:12 2017 +0100
+++ b/__pkginfo__.py	Thu Jan 19 10:26:56 2017 +0100
@@ -8,8 +8,8 @@
 modname = 'seda'
 distname = 'cubicweb-seda'
 
-numversion = (0, 5, 1)
-version = '.'.join(str(num) for num in numversion)
+numversion = (0, 6, 0)
+version = '.'.join(str(num) for num in numversion) + '.pre0'
 
 license = 'LGPL'
 author = 'LOGILAB S.A. (Paris, FRANCE)'
--- a/migration/0.6.0_Any.py	Wed Jan 18 15:35:12 2017 +0100
+++ b/migration/0.6.0_Any.py	Thu Jan 19 10:26:56 2017 +0100
@@ -17,7 +17,8 @@
         'NOT X user_annotation NULL')
     rql('SET X user_annotation XI WHERE X id XI, '
         'X user_annotation NULL')
-commit()
+    commit()
+
 for etype in ('SEDAArchiveUnit', 'SEDABinaryDataObject', 'SEDAPhysicalDataObject'):
     drop_attribute(etype, 'id')
     sync_schema_props_perms((etype, 'user_annotation', 'String'))
@@ -29,16 +30,19 @@
     for target in targets:
         if role == 'subject':
             add_relation_definition('SEDASeqAltArchiveUnitArchiveUnitRefIdManagement',
-                                    rschema.type, target)
+                                    rschema.type, target, ask_confirm=False)
         else:
             add_relation_definition(target, rschema.type,
-                                    'SEDASeqAltArchiveUnitArchiveUnitRefIdManagement')
+                                    'SEDASeqAltArchiveUnitArchiveUnitRefIdManagement',
+                                    ask_confirm=False)
     with cnx.deny_all_hooks_but():
         if role == 'subject':
-            rql('SET SEQ {0} X WHERE C seda_content SEQ, C {0} X'.format(rschema))
+            rql('SET SEQ {0} X WHERE C seda_content SEQ, C {0} X'.format(rschema),
+                ask_confirm=False)
         else:
-            rql('SET X {0} SEQ WHERE C seda_content SEQ, X {0} C'.format(rschema))
-        commit()
+            rql('SET X {0} SEQ WHERE C seda_content SEQ, X {0} C'.format(rschema),
+                ask_confirm=False)
+        commit(ask_confirm=False)
 drop_entity_type('SEDAContent')
 
 add_cube('eac')