[migration] Drop cw_schema relation first 3.24
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 08 Nov 2016 18:37:47 +0100
branch3.24
changeset 11808 4a387179fa33
parent 11807 9d478b81f6d7
child 11809 11365e5c11d7
[migration] Drop cw_schema relation first without this, we ends up with the traceback shown at https://www.cubicweb.org/ticket/16130960. This is not the proper fix, which I have not been able to find. It seems due to this very rare case of deletion of such relation linked to CWRType vs order of execution of operation (in this case, the operation deleting the entity table is run before some other queries using it). As forcing this relation to be deleted before the entity type fixes the problem while this case seems rare enough, IMO this patch is "good enough". Closes #16130960
cubicweb/misc/migration/3.24.0_Any.py
--- a/cubicweb/misc/migration/3.24.0_Any.py	Tue Nov 08 18:34:22 2016 +0100
+++ b/cubicweb/misc/migration/3.24.0_Any.py	Tue Nov 08 18:37:47 2016 +0100
@@ -8,4 +8,6 @@
 sql('ALTER TABLE entities DROP COLUMN extid')
 sql('DROP INDEX entities_type_idx')
 
+# force cw_schema deletion before CWSourceSchemaConfig to avoid nasty bug
+drop_relation_type('cw_schema')
 drop_entity_type('CWSourceSchemaConfig')