server/migractions.py
branchstable
changeset 9600 bde625698f44
parent 9588 fe267b7336f3
parent 9565 fa00fc251d57
child 9635 aaf099172bb9
child 9698 737983d87497
equal deleted inserted replaced
9599:13dd3a57dabb 9600:bde625698f44
   616         if syncprops:
   616         if syncprops:
   617             # properties
   617             # properties
   618             self.rqlexecall(ss.updaterdef2rql(rdef, repordef.eid),
   618             self.rqlexecall(ss.updaterdef2rql(rdef, repordef.eid),
   619                             ask_confirm=confirm)
   619                             ask_confirm=confirm)
   620             # constraints
   620             # constraints
   621             newconstraints = list(rdef.constraints)
   621             # 0. eliminate the set of unmodified constraints from the sets of
       
   622             # old/new constraints
       
   623             newconstraints = set(rdef.constraints)
       
   624             oldconstraints = set(repordef.constraints)
       
   625             unchanged_constraints = newconstraints & oldconstraints
       
   626             newconstraints -= unchanged_constraints
       
   627             oldconstraints -= unchanged_constraints
   622             # 1. remove old constraints and update constraints of the same type
   628             # 1. remove old constraints and update constraints of the same type
   623             # NOTE: don't use rschema.constraint_by_type because it may be
   629             # NOTE: don't use rschema.constraint_by_type because it may be
   624             #       out of sync with newconstraints when multiple
   630             #       out of sync with newconstraints when multiple
   625             #       constraints of the same type are used
   631             #       constraints of the same type are used
   626             for cstr in repordef.constraints:
   632             for cstr in oldconstraints:
   627                 for newcstr in newconstraints:
   633                 for newcstr in newconstraints:
   628                     if newcstr.type() == cstr.type():
   634                     if newcstr.type() == cstr.type():
   629                         break
   635                         break
   630                 else:
   636                 else:
   631                     newcstr = None
   637                     newcstr = None