#23407: makemigrations doesn't use --noinput
------------------------------------------------+------------------------
Reporter: bmispelon | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Migrations | Version: 1.7
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+------------------------
#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:
{{{#!python
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
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23407>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/052.7a3c50c25d4cb9ea56df46dd8466bac7%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.