server/migractions.py
branchstable
changeset 9565 fa00fc251d57
parent 9241 cbee712dd310
child 9600 bde625698f44
--- a/server/migractions.py	Mon Mar 10 16:07:41 2014 +0100
+++ b/server/migractions.py	Mon Mar 10 15:17:50 2014 +0100
@@ -619,12 +619,18 @@
             self.rqlexecall(ss.updaterdef2rql(rdef, repordef.eid),
                             ask_confirm=confirm)
             # constraints
-            newconstraints = list(rdef.constraints)
+            # 0. eliminate the set of unmodified constraints from the sets of
+            # old/new constraints
+            newconstraints = set(rdef.constraints)
+            oldconstraints = set(repordef.constraints)
+            unchanged_constraints = newconstraints & oldconstraints
+            newconstraints -= unchanged_constraints
+            oldconstraints -= unchanged_constraints
             # 1. remove old constraints and update constraints of the same type
             # NOTE: don't use rschema.constraint_by_type because it may be
             #       out of sync with newconstraints when multiple
             #       constraints of the same type are used
-            for cstr in repordef.constraints:
+            for cstr in oldconstraints:
                 for newcstr in newconstraints:
                     if newcstr.type() == cstr.type():
                         break