Explorar el Código

HUE-7692 [editor] Upgrade failure from from CDH <= 5.4

jdesjean hace 8 años
padre
commit
02e51bc

+ 4 - 1
desktop/core/src/desktop/migrations/0016_auto__add_unique_document2_uuid_version_is_history.py

@@ -14,10 +14,13 @@ class Migration(SchemaMigration):
         # As opposed to Document1, we can't just delete Document2 documents if
         # there is a duplication because it actually holds data. So instead
         # we'll just find duplications and emit a better error message.
+        # Note we reset the `order_by` to make sure to prevent error with mysql:
+        # ORDER BY clause is not in GROUP BY clause and contains nonaggregated column.
         duplicated_records = Document2.objects \
          .values('uuid', 'version', 'is_history') \
          .annotate(id_count=models.Count('id')) \
-         .filter(id_count__gt=1)
+         .filter(id_count__gt=1) \
+         .order_by()
 
 
         duplicated_records = list(duplicated_records)