summaryrefslogtreecommitdiff
path: root/django/db/backends/mysql/introspection.py
diff options
context:
space:
mode:
authorThomas Grainger <tagrain@gmail.com>2018-06-29 15:43:53 +0100
committerTim Graham <timograham@gmail.com>2018-06-29 10:43:53 -0400
commit4fba321a457e52df77d0b512d043019e9f6b0bc9 (patch)
tree1e1dfd404295e8a2a631ab8d7f7c1e3e9ee21b7d /django/db/backends/mysql/introspection.py
parentd22b90b4eabc1fe9b7b35aada441e0edf5ebd6d8 (diff)
downloaddjango-4fba321a457e52df77d0b512d043019e9f6b0bc9.tar.gz
Fixed #29480 -- Made MySQL backend retrieve constraint columns in their defined order.
Diffstat (limited to 'django/db/backends/mysql/introspection.py')
-rw-r--r--django/db/backends/mysql/introspection.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/django/db/backends/mysql/introspection.py b/django/db/backends/mysql/introspection.py
index 9520e890ea..56280b6fe5 100644
--- a/django/db/backends/mysql/introspection.py
+++ b/django/db/backends/mysql/introspection.py
@@ -160,6 +160,7 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
WHERE
kc.table_schema = DATABASE() AND
kc.table_name = %s
+ ORDER BY kc.`ordinal_position`
"""
cursor.execute(name_query, [table_name])
for constraint, column, ref_table, ref_column in cursor.fetchall():