makemigrations doesn't use --noinput
|Reported by:||bmispelon||Owned by:||knbk|
|Cc:||Triage Stage:||Ready for checkin|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
#22862 added the --noinput to the makemigrations command but only when using --merge.
It seems to me that it would be a useful addition to the plain makemigrations too and could work like this:
- If the migrations can be created without user input, create it
- If not, raise an error.
I tried changing the code to use MigrationQuestioner instead of InteractiveMigrationQuestioner but it seems that this just creates a migration with default=None which might not be what you want.
Implementing a new questioner object like this seems to work in my limited testcase:
class NonInteractiveQuestioner(MigrationQuestioner): def ask_not_null_addition(self, field_name, model_name): raise NotImplementedError def ask_rename(self, model_name, old_name, new_name, field_instance): raise NotImplementedError def ask_rename_model(self, old_model_state, new_model_state): raise NotImplementedError def ask_merge(self, app_label): raise NotImplementedError
Change History (12)
comment:2 Changed 13 months ago by timgraham
- Severity changed from Normal to Release blocker
- Triage Stage changed from Unreviewed to Accepted
comment:9 Changed 7 months ago by knbk
- Owner changed from nobody to knbk
- Status changed from new to assigned