mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Fixed #28386 -- Made operations within non-atomic migrations honor the operation's atomic flag when migrating backwards.
This commit is contained in:
parent
5893eaddf4
commit
7937cc16f5
5 changed files with 16 additions and 3 deletions
|
@ -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",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue