don't update constraints when it's not necessary stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 18 Mar 2010 17:33:35 +0100
branchstable
changeset 4947 c3ded0287295
parent 4946 2654cd5c87e0
child 4948 5774491a1421
don't update constraints when it's not necessary
server/migractions.py
--- a/server/migractions.py	Thu Mar 18 17:33:03 2010 +0100
+++ b/server/migractions.py	Thu Mar 18 17:33:35 2010 +0100
@@ -499,15 +499,13 @@
                     self.rqlexec('DELETE X constrained_by C WHERE C eid %(x)s',
                                  {'x': cstr.eid}, 'x',
                                  ask_confirm=confirm)
-                    self.rqlexec('DELETE CWConstraint C WHERE C eid %(x)s',
-                                 {'x': cstr.eid}, 'x',
-                                 ask_confirm=confirm)
                 else:
                     newconstraints.remove(newcstr)
-                    values = {'x': cstr.eid,
-                              'v': unicode(newcstr.serialize())}
-                    self.rqlexec('SET X value %(v)s WHERE X eid %(x)s',
-                                 values, 'x', ask_confirm=confirm)
+                    value = unicode(newcstr.serialize())
+                    if value != unicode(cstr.serialize()):
+                        self.rqlexec('SET X value %(v)s WHERE X eid %(x)s',
+                                     {'x': cstr.eid, 'v': value}, 'x',
+                                     ask_confirm=confirm)
             # 2. add new constraints
             for newcstr in newconstraints:
                 self.rqlexecall(ss.constraint2rql(rschema, subjtype, objtype,