Fixed #29480 -- Made MySQL backend retrieve constraint columns in their defined order.

This commit is contained in:
Thomas Grainger 2018-06-29 15:43:53 +01:00 committed by Tim Graham
parent d22b90b4ea
commit 4fba321a45
1 changed files with 1 additions and 0 deletions

View File

@ -160,6 +160,7 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
WHERE WHERE
kc.table_schema = DATABASE() AND kc.table_schema = DATABASE() AND
kc.table_name = %s kc.table_name = %s
ORDER BY kc.`ordinal_position`
""" """
cursor.execute(name_query, [table_name]) cursor.execute(name_query, [table_name])
for constraint, column, ref_table, ref_column in cursor.fetchall(): for constraint, column, ref_table, ref_column in cursor.fetchall():