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