diff --git a/django/db/backends/mysql/schema.py b/django/db/backends/mysql/schema.py index 39450dd50d..6402bc7145 100644 --- a/django/db/backends/mysql/schema.py +++ b/django/db/backends/mysql/schema.py @@ -107,7 +107,9 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): }, [effective_default]) def _field_should_be_indexed(self, model, field): - create_index = super()._field_should_be_indexed(model, field) + if not super()._field_should_be_indexed(model, field): + return False + storage = self.connection.introspection.get_storage_engine( self.connection.cursor(), model._meta.db_table ) @@ -115,11 +117,10 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): # db_constraint=False because the index from that constraint won't be # created. if (storage == "InnoDB" and - create_index and field.get_internal_type() == 'ForeignKey' and field.db_constraint): return False - return not self._is_limited_data_type(field) and create_index + return not self._is_limited_data_type(field) def _delete_composed_index(self, model, fields, *args): """