# HG changeset patch # User Aurelien Campeas # Date 1393521029 -3600 # Node ID 072429be2d95e0bb20ae5220d9520231668f2a2c # Parent 43b4895a150fbe8bf6c8ca6eaa206a4570f66403 [hooks/syncschema] do not crash on double removal of a constraint Some complicated migrations may entail a double constraint removal. It is not yet known whether this is a genuine cw bug or the result of a complicated migration story, but we should nevertheless not crash. Rather, emit a CRITICAL warning and proceed. Closes #3595309. diff -r 43b4895a150f -r 072429be2d95 hooks/syncschema.py --- a/hooks/syncschema.py Fri Feb 14 17:52:49 2014 +0100 +++ b/hooks/syncschema.py Thu Feb 27 18:10:29 2014 +0100 @@ -676,7 +676,11 @@ rdef = self.rdef # in-place modification of in-memory schema first _set_modifiable_constraints(rdef) - rdef.constraints.remove(self.oldcstr) + if self.oldcstr in rdef.constraints: + rdef.constraints.remove(self.oldcstr) + else: + self.critical('constraint %s for rdef %s was missing or already removed', + self.oldcstr, rdef) # then update database: alter the physical schema on size/unique # constraint changes syssource = session.cnxset.source('system')