summaryrefslogtreecommitdiff
path: root/tests/migrations/test_executor.py
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2016-05-22 20:35:10 -0400
committerSimon Charette <charette.s@gmail.com>2016-05-26 13:30:10 -0400
commit36d36818a30025034cad6f1ee59b2a960a6582ec (patch)
tree9e4846b80fadfb9e91feb9f3d785af593de2c0f1 /tests/migrations/test_executor.py
parent30d110ef43d8a3c50ea8ec4e4fe49bd2bb859530 (diff)
Fixed #26647 -- Included the state of all applied migrations when migrating forward.
Thanks Jasper Maes for the detailed report.
Diffstat (limited to 'tests/migrations/test_executor.py')
-rw-r--r--tests/migrations/test_executor.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/migrations/test_executor.py b/tests/migrations/test_executor.py
index b51e7be90e..7c33c1be5c 100644
--- a/tests/migrations/test_executor.py
+++ b/tests/migrations/test_executor.py
@@ -477,6 +477,34 @@ class ExecutorTests(MigrationTestBase):
self.assertTableNotExists("lookuperror_b_b1")
self.assertTableNotExists("lookuperror_c_c1")
+ @override_settings(
+ INSTALLED_APPS=[
+ 'migrations.migrations_test_apps.mutate_state_a',
+ 'migrations.migrations_test_apps.mutate_state_b',
+ ]
+ )
+ def test_unrelated_applied_migrations_mutate_state(self):
+ """
+ #26647 - Unrelated applied migrations should be part of the final
+ state in both directions.
+ """
+ executor = MigrationExecutor(connection)
+ executor.migrate([
+ ('mutate_state_b', '0002_add_field'),
+ ])
+ # Migrate forward.
+ executor.loader.build_graph()
+ state = executor.migrate([
+ ('mutate_state_a', '0001_initial'),
+ ])
+ self.assertIn('added', dict(state.models['mutate_state_b', 'b'].fields))
+ executor.loader.build_graph()
+ # Migrate backward.
+ state = executor.migrate([
+ ('mutate_state_a', None),
+ ])
+ self.assertIn('added', dict(state.models['mutate_state_b', 'b'].fields))
+
@override_settings(MIGRATION_MODULES={"migrations": "migrations.test_migrations"})
def test_process_callback(self):
"""