mirror of
https://github.com/django/django.git
synced 2025-11-02 04:48:33 +00:00
Fixed #22881 -- Better soft_applied migration detection
This commit is contained in:
parent
ecc06d44ed
commit
21c496ea52
3 changed files with 25 additions and 4 deletions
|
|
@ -155,6 +155,12 @@ class ExecutorTests(MigrationTestBase):
|
|||
self.assertTableNotExists("migrations_author")
|
||||
self.assertTableNotExists("migrations_tribble")
|
||||
# Run it normally
|
||||
self.assertEqual(
|
||||
executor.migration_plan([("migrations", "0001_initial")]),
|
||||
[
|
||||
(executor.loader.graph.nodes["migrations", "0001_initial"], False),
|
||||
],
|
||||
)
|
||||
executor.migrate([("migrations", "0001_initial")])
|
||||
# Are the tables there now?
|
||||
self.assertTableExists("migrations_author")
|
||||
|
|
@ -171,9 +177,17 @@ class ExecutorTests(MigrationTestBase):
|
|||
# Make sure that was faked
|
||||
self.assertEqual(state["faked"], True)
|
||||
# Finally, migrate forwards; this should fake-apply our initial migration
|
||||
executor.loader.build_graph()
|
||||
self.assertEqual(
|
||||
executor.migration_plan([("migrations", "0001_initial")]),
|
||||
[
|
||||
(executor.loader.graph.nodes["migrations", "0001_initial"], False),
|
||||
],
|
||||
)
|
||||
executor.migrate([("migrations", "0001_initial")])
|
||||
self.assertEqual(state["faked"], True)
|
||||
# And migrate back to clean up the database
|
||||
executor.loader.build_graph()
|
||||
executor.migrate([("migrations", None)])
|
||||
self.assertTableNotExists("migrations_author")
|
||||
self.assertTableNotExists("migrations_tribble")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue