[migration] Add migration script to synchronize compound etypes / relations
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 13 Jun 2017 14:29:10 +0200
changeset 2649 8e9585bcc97c
parent 2646 a21a6e5f04c4
child 2650 3febc73ffa1b
[migration] Add migration script to synchronize compound etypes / relations missed by 8f1a4f7abbf6 Related to extranet #25271719
cubicweb_seda/migration/0.10.4_Any.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cubicweb_seda/migration/0.10.4_Any.py	Tue Jun 13 14:29:10 2017 +0200
@@ -0,0 +1,15 @@
+from __future__ import print_function
+
+from cubicweb_seda import seda_profile_container_def, iter_all_rdefs
+
+for etype, parent_rdefs in seda_profile_container_def(schema):
+    sync_schema_props_perms(etype, syncprops=False)
+
+for rdef, role in iter_all_rdefs(schema, 'SEDAArchiveTransfer'):
+    try:
+        fsschema[rdef.rtype].rdefs[(rdef.subject, rdef.object)]
+    except KeyError:
+        print('junk detected in database schema', rdef)
+    else:
+        sync_schema_props_perms((rdef.subject, rdef.rtype, rdef.object),
+                                syncprops=False)