mirror of https://github.com/django/django.git
Fixed DatabaseFeatures.supports_index_column_ordering and related tests with MyISAM storage engine.
This commit is contained in:
parent
1bdfde0857
commit
fdfb3086fc
|
@ -328,6 +328,8 @@ class DatabaseFeatures(BaseDatabaseFeatures):
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def supports_index_column_ordering(self):
|
def supports_index_column_ordering(self):
|
||||||
|
if self._mysql_storage_engine != "InnoDB":
|
||||||
|
return False
|
||||||
if self.connection.mysql_is_mariadb:
|
if self.connection.mysql_is_mariadb:
|
||||||
return self.connection.mysql_version >= (10, 8)
|
return self.connection.mysql_version >= (10, 8)
|
||||||
return self.connection.mysql_version >= (8, 0, 1)
|
return self.connection.mysql_version >= (8, 0, 1)
|
||||||
|
|
|
@ -111,6 +111,10 @@ class Index:
|
||||||
for field_name, _ in self.fields_orders
|
for field_name, _ in self.fields_orders
|
||||||
]
|
]
|
||||||
col_suffixes = [order[1] for order in self.fields_orders]
|
col_suffixes = [order[1] for order in self.fields_orders]
|
||||||
|
if schema_editor.connection.features.supports_index_column_ordering:
|
||||||
|
col_suffixes = [order[1] for order in self.fields_orders]
|
||||||
|
else:
|
||||||
|
col_suffixes = [""] * len(self.fields_orders)
|
||||||
expressions = None
|
expressions = None
|
||||||
return schema_editor._create_index_sql(
|
return schema_editor._create_index_sql(
|
||||||
model,
|
model,
|
||||||
|
|
|
@ -93,6 +93,7 @@ class SchemaIndexesTests(TestCase):
|
||||||
str(index.create_sql(Article, editor)),
|
str(index.create_sql(Article, editor)),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@skipUnlessDBFeature("supports_index_column_ordering")
|
||||||
def test_descending_columns_list_sql(self):
|
def test_descending_columns_list_sql(self):
|
||||||
index = Index(fields=["-headline"], name="whitespace_idx")
|
index = Index(fields=["-headline"], name="whitespace_idx")
|
||||||
editor = connection.schema_editor()
|
editor = connection.schema_editor()
|
||||||
|
|
Loading…
Reference in New Issue