A dependency to an app with existing migrations uses the last migration of that app.
(self)
| 5101 | |
| 5102 | @override_settings(MIGRATION_MODULES={"migrations": "migrations.test_migrations"}) |
| 5103 | def test_last_dependency(self): |
| 5104 | """ |
| 5105 | A dependency to an app with existing migrations uses the |
| 5106 | last migration of that app. |
| 5107 | """ |
| 5108 | # Load graph |
| 5109 | loader = MigrationLoader(connection) |
| 5110 | before = self.make_project_state([]) |
| 5111 | after = self.make_project_state([self.book_migrations_fk]) |
| 5112 | after.real_apps = {"migrations"} |
| 5113 | autodetector = MigrationAutodetector(before, after) |
| 5114 | changes = autodetector._detect_changes(graph=loader.graph) |
| 5115 | # Right number/type of migrations? |
| 5116 | self.assertNumberMigrations(changes, "otherapp", 1) |
| 5117 | self.assertOperationTypes(changes, "otherapp", 0, ["CreateModel"]) |
| 5118 | self.assertOperationAttributes(changes, "otherapp", 0, 0, name="Book") |
| 5119 | self.assertMigrationDependencies( |
| 5120 | changes, "otherapp", 0, [("migrations", "0002_second")] |
| 5121 | ) |
| 5122 | |
| 5123 | def test_alter_fk_before_model_deletion(self): |
| 5124 | """ |
nothing calls this directly
no test coverage detected