[migration] Reserialize all constraints since yams introduce new JSON serializing format
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 22 Jun 2016 14:35:43 +0200
changeset 11364 a702d31ddd8f
parent 11363 e5fe836df6f1
child 11365 eedf0684533c
[migration] Reserialize all constraints since yams introduce new JSON serializing format So we may drop support for older format in yams at some point.
cubicweb/misc/migration/3.23.0_Any.py
--- a/cubicweb/misc/migration/3.23.0_Any.py	Thu Jun 23 15:45:30 2016 +0200
+++ b/cubicweb/misc/migration/3.23.0_Any.py	Wed Jun 22 14:35:43 2016 +0200
@@ -48,6 +48,8 @@
     cwrdef = cwconstraint.reverse_constrained_by[0]
     rdef = cwrdef.yams_schema()
     cstr = rdef.constraint_by_eid(cwconstraint.eid)
+    with cnx.deny_all_hooks_but():
+        cwconstraint.cw_set(value=unicode(cstr.serialize()))
     if cstr.type() not in ('BoundaryConstraint', 'IntervalBoundConstraint',
                            'StaticVocabularyConstraint'):
         # These cannot be translate into backend CHECK.
@@ -58,4 +60,3 @@
     sql('ALTER TABLE cw_%(e)s ADD CONSTRAINT %(c)s CHECK(%(v)s)' % args)
 
 commit()
-