Fixed #32350 -- Fixed showmigrations crash for applied squashed migrations.#13890
Fixed #32350 -- Fixed showmigrations crash for applied squashed migrations.#13890felixxm merged 1 commit intodjango:masterfrom
Conversation
tests/migrations/test_migrations_initial_squash/0001_initial.py
Outdated
Show resolved
Hide resolved
tests/migrations/test_migrations_initial_squash/0001_initial.py
Outdated
Show resolved
Hide resolved
tests/migrations/test_migrations_initial_squash/0001_initial.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Thanks for the adjustments @danielebra!
Per the documentation if replaces is used then the replaced migrations should still be around
You must then transition the squashed migration to a normal migration by:
- Deleting all the migration files it replaces.
- Updating all migrations that depend on the deleted migrations to depend on the squashed migration instead.
- Removing the replaces attribute in the Migration class of the squashed migration (this is how Django tells that it is a squashed migration).
So I'd add test_migrations_initial_squash/0001_initial.py and test_migrations_initial_squash/0002_replaced.py as well. I managed to reproduce even with these files around but at least we're sure not to test an unsupported setup.
I'll submit a PR to deal with the Running (pre/post)-migrate handlers for application migrations messages during test runs.
|
Thanks for the feedback @charettes, apologies for the late reply. I have added in the first and second migration steps. Please review when convenient. |
charettes
left a comment
There was a problem hiding this comment.
Beyond the stylistic adjustments this LGTM. Thanks for the patch @danielebra!
felixxm
left a comment
There was a problem hiding this comment.
@danielebra Thanks for this patch 👍 Welcome aboard ⛵
I pushed small edits to tests and reused an existing set of migrations test_migrations_squashed.
…tions. Thanks Simon Charette for reviews.
https://code.djangoproject.com/ticket/32350#ticket
Some migrations don't have an applied timestamp, this pull requests ensures a check takes place before attempting to show it.