diff options
| author | John Whitman <jwhitman@galileo.io> | 2023-08-28 14:16:38 -0400 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-08-30 12:46:15 +0200 |
| commit | 68a8996bdfce2d191decd7b1c1a2b9fdea8e4b2f (patch) | |
| tree | 0722940994234b53db11002f8317404e7b4426a4 /django | |
| parent | 3f8dbe267d35f0219277f0fe2d79915a4fb2b045 (diff) | |
Fixed #34799 -- Made MySQL introspection skip cross-database relations.
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/backends/mysql/introspection.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/django/db/backends/mysql/introspection.py b/django/db/backends/mysql/introspection.py index a1ee51a692..ea1d0aa187 100644 --- a/django/db/backends/mysql/introspection.py +++ b/django/db/backends/mysql/introspection.py @@ -198,6 +198,7 @@ class DatabaseIntrospection(BaseDatabaseIntrospection): FROM information_schema.key_column_usage WHERE table_name = %s AND table_schema = DATABASE() + AND referenced_table_schema = DATABASE() AND referenced_table_name IS NOT NULL AND referenced_column_name IS NOT NULL """, @@ -257,6 +258,10 @@ class DatabaseIntrospection(BaseDatabaseIntrospection): information_schema.table_constraints AS c WHERE kc.table_schema = DATABASE() AND + ( + kc.referenced_table_schema = DATABASE() OR + kc.referenced_table_schema IS NULL + ) AND c.table_schema = kc.table_schema AND c.constraint_name = kc.constraint_name AND c.constraint_type != 'CHECK' AND |
