mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	Fixed DatabaseFeatures.supports_index_column_ordering and related tests with MyISAM storage engine.
This commit is contained in:
		| @@ -328,6 +328,8 @@ class DatabaseFeatures(BaseDatabaseFeatures): | ||||
|  | ||||
|     @cached_property | ||||
|     def supports_index_column_ordering(self): | ||||
|         if self._mysql_storage_engine != "InnoDB": | ||||
|             return False | ||||
|         if self.connection.mysql_is_mariadb: | ||||
|             return self.connection.mysql_version >= (10, 8) | ||||
|         return self.connection.mysql_version >= (8, 0, 1) | ||||
|   | ||||
| @@ -111,6 +111,10 @@ class Index: | ||||
|                 for field_name, _ 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 | ||||
|         return schema_editor._create_index_sql( | ||||
|             model, | ||||
|   | ||||
| @@ -93,6 +93,7 @@ class SchemaIndexesTests(TestCase): | ||||
|             str(index.create_sql(Article, editor)), | ||||
|         ) | ||||
|  | ||||
|     @skipUnlessDBFeature("supports_index_column_ordering") | ||||
|     def test_descending_columns_list_sql(self): | ||||
|         index = Index(fields=["-headline"], name="whitespace_idx") | ||||
|         editor = connection.schema_editor() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user