#24735: "manage.py makemigrations --noinput" asks for renaming of fields
----------------------------+--------------------
Reporter: blueyed | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.8
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
----------------------------+--------------------
I am trying to use `./manage.py makemigrations --exit --dry-run --noinput`
to detect if there are changes.
Although `--noinput` is specified, it asks about a renamed field:
{{{
Did you rename model.foo to model.bar (a CharField)? [y/N] ^CTraceback
(most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "…/django18/django/core/management/__init__.py", line 338, in
execute_from_command_line
utility.execute()
File "…/django18/django/core/management/__init__.py", line 330, in
execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "…/django18/django/core/management/base.py", line 390, in
run_from_argv
self.execute(*args, **cmd_options)
File "…/django18/django/core/management/base.py", line 441, in execute
output = self.handle(*args, **options)
File "…/django18/django/core/management/commands/makemigrations.py",
line 125, in handle
migration_name=self.migration_name,
File "…/django18/django/db/migrations/autodetector.py", line 43, in
changes
changes = self._detect_changes(convert_apps, graph)
File "…/django18/django/db/migrations/autodetector.py", line 183, in
_detect_changes
self.generate_renamed_fields()
File "…/django18/django/db/migrations/autodetector.py", line 744, in
generate_renamed_fields
if self.questioner.ask_rename(model_name, rem_field_name, field_name,
field):
File "…/django18/django/db/migrations/questioner.py", line 168, in
ask_rename
field_instance.__class__.__name__), False)
File "…/django18/django/db/migrations/questioner.py", line 80, in
_boolean_input
result = input("%s " % question)
KeyboardInterrupt
}}}
I've also tried closing stdin via `</dev/null`, but that results in
another error:
{{{
File "/home/daniel/Vcs/django18/django/db/migrations/questioner.py",
line 168, in ask_rename
field_instance.__class__.__name__), False)
File "/home/daniel/Vcs/django18/django/db/migrations/questioner.py",
line 80, in _boolean_input
result = input("%s " % question)
EOFError: EOF when reading a line
}}}
Does it make sense with `--noinput` to automatically assume that the field
has been renamed?
Would the `autodetector` in `handle()` need to get passed a
`MigrationQuestioner` instance, like it's done in `handle_merge`?
--
Ticket URL: <https://code.djangoproject.com/ticket/24735>
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/050.5db39fe132ffd7dcda7c39f8fe9fae9c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.