716 self.size_cstr_changed = True |
716 self.size_cstr_changed = True |
717 elif cstrtype == 'UniqueConstraint': |
717 elif cstrtype == 'UniqueConstraint': |
718 syssource.update_rdef_unique(cnx, rdef) |
718 syssource.update_rdef_unique(cnx, rdef) |
719 self.unique_changed = True |
719 self.unique_changed = True |
720 if cstrtype in ('BoundaryConstraint', 'IntervalBoundConstraint', 'StaticVocabularyConstraint'): |
720 if cstrtype in ('BoundaryConstraint', 'IntervalBoundConstraint', 'StaticVocabularyConstraint'): |
721 cstrname = 'cstr' + md5(rdef.subject.type + rdef.rtype.type + cstrtype + |
721 cstrname = 'cstr' + md5((rdef.subject.type + rdef.rtype.type + cstrtype + |
722 (self.oldcstr.serialize() or '')).hexdigest() |
722 (self.oldcstr.serialize() or '')).encode('utf-8')).hexdigest() |
723 cnx.system_sql('ALTER TABLE %s%s DROP CONSTRAINT %s' % (SQL_PREFIX, rdef.subject.type, cstrname)) |
723 cnx.system_sql('ALTER TABLE %s%s DROP CONSTRAINT %s' % (SQL_PREFIX, rdef.subject.type, cstrname)) |
724 |
724 |
725 def revertprecommit_event(self): |
725 def revertprecommit_event(self): |
726 # revert changes on in memory schema |
726 # revert changes on in memory schema |
727 if self.newcstr is not None: |
727 if self.newcstr is not None: |