[hooks/syncschema] make sure CWUniqueTogetherConstraintDelOp happens before CWConstraintDelOp
SQLServer refuses to index an unlimited text column, so we should drop
unique_together constraints (which imply an index) before we drop size
constraints. Closes #5560601.
--- a/hooks/syncschema.py Wed Sep 23 15:00:33 2015 +0200
+++ b/hooks/syncschema.py Wed Sep 23 15:01:55 2015 +0200
@@ -750,6 +750,13 @@
entity = cstrname = None # for pylint
cols = () # for pylint
+ def insert_index(self):
+ # We need to run before CWConstraintDelOp: if a size constraint is
+ # removed and the column is part of a unique_together constraint, we
+ # remove the unique_together index before changing the column's type.
+ # SQL Server does not support unique indices on unlimited text columns.
+ return 0
+
def precommit_event(self):
cnx = self.cnx
prefix = SQL_PREFIX