Running a single squashed migration should record all of the original replaced migrations as run.
(self)
| 1316 | MIGRATION_MODULES={"migrations": "migrations.test_migrations_squashed"} |
| 1317 | ) |
| 1318 | def test_migrate_record_replaced(self): |
| 1319 | """ |
| 1320 | Running a single squashed migration should record all of the original |
| 1321 | replaced migrations as run. |
| 1322 | """ |
| 1323 | recorder = MigrationRecorder(connection) |
| 1324 | out = io.StringIO() |
| 1325 | call_command("migrate", "migrations", verbosity=0) |
| 1326 | call_command("showmigrations", "migrations", stdout=out, no_color=True) |
| 1327 | self.assertEqual( |
| 1328 | "migrations\n [x] 0001_squashed_0002 (2 squashed migrations)\n", |
| 1329 | out.getvalue().lower(), |
| 1330 | ) |
| 1331 | applied_migrations = recorder.applied_migrations() |
| 1332 | self.assertIn(("migrations", "0001_initial"), applied_migrations) |
| 1333 | self.assertIn(("migrations", "0002_second"), applied_migrations) |
| 1334 | self.assertIn(("migrations", "0001_squashed_0002"), applied_migrations) |
| 1335 | # Rollback changes |
| 1336 | call_command("migrate", "migrations", "zero", verbosity=0) |
| 1337 | |
| 1338 | @override_settings( |
| 1339 | MIGRATION_MODULES={"migrations": "migrations.test_migrations_squashed"} |
nothing calls this directly
no test coverage detected