|
@@ -127,12 +127,13 @@ class OperationTests(MigrationTestBase):
|
|
|
self.assertTableExists("test_adflmm_pony_stables")
|
|
|
self.assertColumnNotExists("test_adflmm_pony", "stables")
|
|
|
# Make sure the M2M field actually works
|
|
|
- app_cache = new_state.render()
|
|
|
- Pony = app_cache.get_model("test_adflmm", "Pony")
|
|
|
- p = Pony.objects.create(pink=False, weight=4.55)
|
|
|
- p.stables.create()
|
|
|
- self.assertEqual(p.stables.count(), 1)
|
|
|
- p.stables.all().delete()
|
|
|
+ with atomic():
|
|
|
+ app_cache = new_state.render()
|
|
|
+ Pony = app_cache.get_model("test_adflmm", "Pony")
|
|
|
+ p = Pony.objects.create(pink=False, weight=4.55)
|
|
|
+ p.stables.create()
|
|
|
+ self.assertEqual(p.stables.count(), 1)
|
|
|
+ p.stables.all().delete()
|
|
|
# And test reversal
|
|
|
with connection.schema_editor() as editor:
|
|
|
operation.database_backwards("test_adflmm", editor, new_state, project_state)
|