[schemaserial] be robust against duplicated CWUniqueTogetherConstrain entities arising from bug in the pre 3.18 era stable
authorAurelien Campeas <aurelien.campeas@logilab.fr>
Mon, 24 Nov 2014 12:36:17 +0100
branchstable
changeset 10054 8f7291354095
parent 10053 079b5279a2cd
child 10055 b23043546f2c
[schemaserial] be robust against duplicated CWUniqueTogetherConstrain entities arising from bug in the pre 3.18 era Closes #4619278.
server/schemaserial.py
--- a/server/schemaserial.py	Mon Feb 17 15:01:23 2014 +0100
+++ b/server/schemaserial.py	Mon Nov 24 12:36:17 2014 +0100
@@ -427,7 +427,14 @@
 
 def uniquetogether2rqls(eschema):
     rql_args = []
+    # robustness against duplicated CWUniqueTogetherConstraint (pre 3.18)
+    columnset = set()
     for columns in eschema._unique_together:
+        if columns in columnset:
+            print ('schemaserial: skipping duplicate unique together %r %r' %
+                   (eschema.type, columns))
+            continue
+        columnset.add(columns)
         rql, args = _uniquetogether2rql(eschema, columns)
         args['name'] = y2sql.unique_index_name(eschema, columns)
         rql_args.append((rql, args))