Opened 6 years ago
Closed 3 years ago
#29470 closed New feature (fixed)
Add output to makemigrations and migrate commands with --noinput
Reported by: | Kurt Wheeler | Owned by: | Jacob Walls |
---|---|---|---|
Component: | Migrations | Version: | 1.11 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The --noinput
option to makemigrations seems to also mean "no output". It would be nice for scripting purposes if there could be some kind of output. When writing a script that helps manage migrations, it would be nice to be able to detect that the migrations needed input from the developer so that the script can fail gracefully and inform the developer that manual intervention is required. Right now the options seem to be to not use the --noinput
options and have the prompt interrupt the script, or to use the option and have no idea when migrations failed because they required input.
I'm not very picky as far as how this functionality should be implemented goes. I would think that a little warning like
"No migrations run because input was required but --noinput option was specified."
would be sufficient. This could be output to stdout or stderr, either all the time or perhaps only if an additional option was set.
Change History (10)
comment:1 by , 6 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
comment:2 by , 3 years ago
From a discussion in a PR for #29026, I think this ticket should be re-opened and handled separately from #29026. My suggestion for addressing this would be to modify the non-interactive questioner so that it logs non-empty output when a question is asked (e.g. saying "Such-and-such question was answered automatically with ..."). This could / should be done using the same output method that the migration command class is using for its logging output.
comment:3 by , 3 years ago
Has patch: | set |
---|---|
Resolution: | duplicate |
Status: | closed → new |
Like Chris, I believe this should be handled separately. Whereas the idea in #29026 is to move some of makemigrations
's current output from stdout
to stderr
, the error messaging asked for in this ticket should go to stderr
regardless, so they don't depend on the changes in #29026.
PR to ~~implement this part of Chris's comment:
In addition, if the answers to one or more questions (provided either automatically from --no-input or manually by the user) cause no migrations to be applied, then the migration command class could log that in any case so the user knows.
I'm in favor of starting with just that change, and only for the non-interactive questioner, i.e. --noinput
.
comment:4 by , 3 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:5 by , 3 years ago
Triage Stage: | Unreviewed → Accepted |
---|
OK, since there's +2 here, let's take a look at a patch. Thanks.
comment:6 by , 3 years ago
Patch needs improvement: | set |
---|
comment:7 by , 3 years ago
Patch needs improvement: | unset |
---|
comment:8 by , 3 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
This looks like a similar request as #29026, even if the proposed implementation is a bit different.