server/migractions.py
branchstable
changeset 9600 bde625698f44
parent 9588 fe267b7336f3
parent 9565 fa00fc251d57
child 9635 aaf099172bb9
child 9698 737983d87497
--- a/server/migractions.py	Tue Apr 01 14:46:55 2014 +0200
+++ b/server/migractions.py	Tue Apr 01 18:09:46 2014 +0200
@@ -618,12 +618,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