diff options
| author | nabil-rady <midorady9999@gmail.com> | 2023-02-15 13:43:51 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-02-15 16:51:31 +0100 |
| commit | 6bdc3c58b65eb32fd63cd41849f00a17a36b4473 (patch) | |
| tree | f122cbfd001972475a4f5743646c96171e61e52e /django/db/backends/base/schema.py | |
| parent | 3cc7a92189f45eab034661359e60ede4c88a6052 (diff) | |
Fixed #34320 -- Make sure constraints names are obtained from truncated columns names.
Diffstat (limited to 'django/db/backends/base/schema.py')
| -rw-r--r-- | django/db/backends/base/schema.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/django/db/backends/base/schema.py b/django/db/backends/base/schema.py index 3a83e14be9..070211f6d2 100644 --- a/django/db/backends/base/schema.py +++ b/django/db/backends/base/schema.py @@ -11,7 +11,7 @@ from django.db.backends.ddl_references import ( Statement, Table, ) -from django.db.backends.utils import names_digest, split_identifier +from django.db.backends.utils import names_digest, split_identifier, truncate_name from django.db.models import Deferrable, Index from django.db.models.sql import Query from django.db.transaction import TransactionManagementError, atomic @@ -1760,7 +1760,11 @@ class BaseDatabaseSchemaEditor: """Return all constraint names matching the columns and conditions.""" if column_names is not None: column_names = [ - self.connection.introspection.identifier_converter(name) + self.connection.introspection.identifier_converter( + truncate_name(name, self.connection.ops.max_name_length()) + ) + if self.connection.features.truncates_names + else self.connection.introspection.identifier_converter(name) for name in column_names ] with self.connection.cursor() as cursor: |
