mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #28386 -- Made operations within non-atomic migrations honor the operation's atomic flag when migrating backwards.
This commit is contained in:
@@ -126,6 +126,14 @@ class ExecutorTests(MigrationTestBase):
|
||||
migrations_apps = executor.loader.project_state(("migrations", "0001_initial")).apps
|
||||
Editor = migrations_apps.get_model("migrations", "Editor")
|
||||
self.assertFalse(Editor.objects.exists())
|
||||
# Record previous migration as successful.
|
||||
executor.migrate([("migrations", "0001_initial")], fake=True)
|
||||
# Rebuild the graph to reflect the new DB state.
|
||||
executor.loader.build_graph()
|
||||
# Migrating backwards is also atomic.
|
||||
with self.assertRaisesMessage(RuntimeError, "Abort migration"):
|
||||
executor.migrate([("migrations", None)])
|
||||
self.assertFalse(Editor.objects.exists())
|
||||
|
||||
@override_settings(MIGRATION_MODULES={
|
||||
"migrations": "migrations.test_migrations",
|
||||
|
||||
Reference in New Issue
Block a user