mirror of
https://github.com/django/django.git
synced 2025-10-25 06:36:07 +00:00
Fixed #27236 -- Deprecated Meta.index_together in favor of Meta.indexes.
This also deprecates AlterIndexTogether migration operation.
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
from unittest.mock import ANY
|
||||
|
||||
from django.core import checks
|
||||
from django.core.checks.migrations import check_migration_operations
|
||||
from django.db import migrations
|
||||
from django.db.migrations.operations.base import Operation
|
||||
from django.test import TestCase
|
||||
from django.test.utils import override_settings
|
||||
|
||||
|
||||
class DeprecatedMigrationOperationTests(TestCase):
|
||||
@@ -50,6 +54,23 @@ class DeprecatedMigrationOperationTests(TestCase):
|
||||
],
|
||||
)
|
||||
|
||||
@override_settings(
|
||||
INSTALLED_APPS=["check_framework.migrations_test_apps.index_together_app"]
|
||||
)
|
||||
def tests_check_alter_index_together(self):
|
||||
errors = check_migration_operations()
|
||||
self.assertEqual(
|
||||
errors,
|
||||
[
|
||||
checks.Warning(
|
||||
"AlterIndexTogether is deprecated. Support for it (except in "
|
||||
"historical migrations) will be removed in Django 5.1.",
|
||||
obj=ANY,
|
||||
id="migrations.W001",
|
||||
)
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
class RemovedMigrationOperationTests(TestCase):
|
||||
def test_default_operation(self):
|
||||
|
||||
Reference in New Issue
Block a user