mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Fixed #24828 -- Allowed migration optimization across AlterFooTogether
The idea behind this change is, that AlterUniqueTogether,
AlterIndexTogether and AlterOrderWithRespectTo can always be moved after
an Add/Alter/Rename/RemoveField operation if they don't refer to the
respective field and are not empty sets / None.
Combined with the optimizations of duplicate AlterUniqueTogether,
AlterIndexTogether, and AlterOrderWithRespectTo operations from
128caa1e16
, these operations are optimized
in a later round of the optimizer.
Thanks Tim Graham for the review.
This commit is contained in:
parent
fb1ba4d63e
commit
e470f311d6
5 changed files with 208 additions and 4 deletions
|
@ -889,7 +889,7 @@ class SquashMigrationsTests(MigrationTestBase):
|
|||
out = six.StringIO()
|
||||
with self.temporary_migration_module(module="migrations.test_migrations"):
|
||||
call_command("squashmigrations", "migrations", "0002", interactive=False, verbosity=1, stdout=out)
|
||||
self.assertIn("Optimized from 7 operations to 5 operations.", force_text(out.getvalue()))
|
||||
self.assertIn("Optimized from 7 operations to 3 operations.", force_text(out.getvalue()))
|
||||
|
||||
def test_ticket_23799_squashmigrations_no_optimize(self):
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue