diff options
| author | Georgi Yanchev <georgi-yanchev@users.noreply.github.com> | 2025-11-18 08:10:25 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-18 08:10:25 -0500 |
| commit | b07298a73a8d444b3618aad8005055bee5ead8cb (patch) | |
| tree | 0f984a336e427f0ca641227b822e7d0b72eab205 /tests/migrations | |
| parent | 3c005b5f79bf6d71f3f4c3692ed670e1722b0fb6 (diff) | |
Fixed #36141 -- Checked for applied replaced migrations recursively.
Regression in 64b1ac7292c72d3551b2ad70b2a78c8fe4af3249.
Diffstat (limited to 'tests/migrations')
| -rw-r--r-- | tests/migrations/test_commands.py | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/tests/migrations/test_commands.py b/tests/migrations/test_commands.py index 83c5575fd3..6a0d9bd6d2 100644 --- a/tests/migrations/test_commands.py +++ b/tests/migrations/test_commands.py @@ -3161,6 +3161,60 @@ class SquashMigrationsTests(MigrationTestBase): ] self.assertNotIn("migrations", applied_app_labels) + def test_double_replaced_migrations_are_checked_correctly(self): + """ + If replaced migrations are already applied and replacing migrations + are not, then migrate should not fail with + InconsistentMigrationHistory. + """ + with self.temporary_migration_module(): + call_command( + "makemigrations", + "migrations", + "--empty", + interactive=False, + verbosity=0, + ) + call_command( + "makemigrations", + "migrations", + "--empty", + interactive=False, + verbosity=0, + ) + call_command( + "makemigrations", + "migrations", + "--empty", + interactive=False, + verbosity=0, + ) + call_command( + "makemigrations", + "migrations", + "--empty", + interactive=False, + verbosity=0, + ) + call_command("migrate", "migrations", interactive=False, verbosity=0) + call_command( + "squashmigrations", + "migrations", + "0001", + "0002", + interactive=False, + verbosity=0, + ) + call_command( + "squashmigrations", + "migrations", + "0001_initial_squashed", + "0003", + interactive=False, + verbosity=0, + ) + call_command("migrate", "migrations", interactive=False, verbosity=0) + def test_squashmigrations_initial_attribute(self): with self.temporary_migration_module( module="migrations.test_migrations" |
