#36185: manage.py migrate --check --prune actually prunes, which is surprising
-----------------------------+--------------------------------------
Reporter: Ari Pollak | Owner: (none)
Type: New feature | Status: closed
Component: Migrations | Version: 5.1
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+--------------------------------------
Changes (by Natalia Bidart):
* resolution: => wontfix
* status: new => closed
* type: Bug => New feature
Comment:
Hello Ari Pollak, thank you for this ticket. I can see the source of
confusion, but I’d like to clarify that `--check is not a `dry-run`-like
option. As described in the help output:
{{{
$ python -Wall manage.py migrate --help
Updates database schema. Manages both apps with migrations and those
without.
[...]
options:
--check Exits with a non-zero status if unapplied
migrations exist and does not actually apply
migrations.
--prune Delete nonexistent migrations from the
django_migrations table.
}}}
The `--check` and `--prune` options operate independently and are
unrelated. `--check` deals with migrations that exist on disk but have not
been applied to the database, while `--prune` does the opposite, removes
migration records from the database that no longer have corresponding
migration files.
Given this, I don’t see a strong reason to prevent these options from
being used together. If the concern is about unintended deletion, perhaps
what this ticket is really suggesting is a `--dry-run` mode for `--prune`?
--
Ticket URL: <
https://code.djangoproject.com/ticket/36185#comment:1>