mirror of
https://github.com/django/django.git
synced 2024-12-01 15:42:04 +01:00
parent
0c06f06131
commit
5b1fb0a75d
@ -155,3 +155,6 @@ Bugfixes
|
|||||||
* Ensured the app registry is fully populated when unpickling models. When an
|
* Ensured the app registry is fully populated when unpickling models. When an
|
||||||
external script (like a queueing infrastructure) reloads pickled models, it
|
external script (like a queueing infrastructure) reloads pickled models, it
|
||||||
could crash with an ``AppRegistryNotReady`` exception (:ticket:`24007`).
|
could crash with an ``AppRegistryNotReady`` exception (:ticket:`24007`).
|
||||||
|
|
||||||
|
* Added quoting to field indexes in the SQL generated by migrations to prevent
|
||||||
|
a crash when the index name requires it (:ticket:`#24015`).
|
||||||
|
@ -12,8 +12,16 @@ class CreationIndexesTests(TestCase):
|
|||||||
Test index handling by the to-be-deprecated connection.creation interface.
|
Test index handling by the to-be-deprecated connection.creation interface.
|
||||||
"""
|
"""
|
||||||
def test_index_together(self):
|
def test_index_together(self):
|
||||||
index_sql = connection.creation.sql_indexes_for_model(Article, no_style())
|
editor = connection.schema_editor()
|
||||||
|
index_sql = editor._model_indexes_sql(Article)
|
||||||
self.assertEqual(len(index_sql), 1)
|
self.assertEqual(len(index_sql), 1)
|
||||||
|
# Ensure the index name is properly quoted
|
||||||
|
self.assertIn(
|
||||||
|
connection.ops.quote_name(
|
||||||
|
editor._create_index_name(Article, ['headline', 'pub_date'], suffix='_idx')
|
||||||
|
),
|
||||||
|
index_sql[0]
|
||||||
|
)
|
||||||
|
|
||||||
def test_index_together_single_list(self):
|
def test_index_together_single_list(self):
|
||||||
# Test for using index_together with a single list (#22172)
|
# Test for using index_together with a single list (#22172)
|
||||||
|
Loading…
Reference in New Issue
Block a user