[migration] Move pyramid-related migration after "entities" table modifications 3.24
authorDenis Laxalde <denis.laxalde@logilab.fr>
Mon, 06 Feb 2017 11:21:31 +0100
branch3.24
changeset 11948 73ed9c204de9
parent 11941 f96f77a190f2
child 11949 1372d9f80c70
[migration] Move pyramid-related migration after "entities" table modifications Otherwise, we getting into `add_entity_type('CWSession')` we try to insert a CWEType without any 'asource' column (per 3.24's schema) whereas the backend still wants it. Closes #17054035.
cubicweb/misc/migration/3.24.0_Any.py
--- a/cubicweb/misc/migration/3.24.0_Any.py	Tue Jan 31 11:06:28 2017 +0100
+++ b/cubicweb/misc/migration/3.24.0_Any.py	Mon Feb 06 11:21:31 2017 +0100
@@ -1,11 +1,6 @@
 from base64 import b64decode
 
 
-# Check the CW versions and add the entity only if needed ?
-add_entity_type('CWSession')
-rql('DELETE CWProperty X WHERE X pkey "system.version.pyramid"',
-    ask_confirm=False)
-
 # before removing extid, ensure it's coherent with cwuri
 for eid, etype, encoded_extid in sql(
         "SELECT eid, type, extid FROM entities, cw_CWSource "
@@ -21,3 +16,8 @@
 # force cw_schema deletion before CWSourceSchemaConfig to avoid nasty bug
 drop_relation_type('cw_schema')
 drop_entity_type('CWSourceSchemaConfig')
+
+# Check the CW versions and add the entity only if needed ?
+add_entity_type('CWSession')
+rql('DELETE CWProperty X WHERE X pkey "system.version.pyramid"',
+    ask_confirm=False)