diff options
| author | Ed Morley <emorley@mozilla.com> | 2016-12-01 15:54:58 +0000 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-12-01 12:25:37 -0500 |
| commit | 82ce55dbbe2d96e8b5d1fcb4a1d52b73e08e7929 (patch) | |
| tree | f747b6913889684a029a06b68c4df443f2425e8e /django | |
| parent | 4074fa91452006890a878f0b6a1a25251461cf26 (diff) | |
[1.10.x] Fixed #27558 -- Prevented redundant index on InnoDB ForeignKey.
The MySQL backend overrides _field_should_be_indexed() so that it skips
index creation for ForeignKeys when using InnoDB.
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/backends/base/schema.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/django/db/backends/base/schema.py b/django/db/backends/base/schema.py index e06b29f3db..0d35f7be68 100644 --- a/django/db/backends/base/schema.py +++ b/django/db/backends/base/schema.py @@ -418,7 +418,7 @@ class BaseDatabaseSchemaEditor(object): } self.execute(sql) # Add an index, if required - if field.db_index and not field.unique: + if self._field_should_be_indexed(model, field): self.deferred_sql.append(self._create_index_sql(model, [field])) # Add any FK constraints later if field.remote_field and self.connection.features.supports_foreign_keys and field.db_constraint: |
