Opened 5 months ago

Closed 5 months ago

Last modified 5 months ago

#33444 closed New feature (wontfix)

Add an option with default answer for makemigrations questions.

Reported by: liudaoqiangtj Owned by: nobody
Component: Migrations Version: 3.2
Severity: Normal Keywords: --noinput
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I am in Django 3.2.6.I execute the command after I rename a field in my table:
"python manage.py makemigrations", I got a raised questioner with "Do you rename book.title to book.content (a BinaryField)? [y/N]? ",

it required a command input "y", but I want to make a default param "y" in this command .

Is there any plan to make a supplement to add a default or optional paramter instead of a questioner of [y/N]?

Change History (3)

comment:1 Changed 5 months ago by John Alcher

The existing flag "--no-input" seems to fit the bill here. Is there a reason why you think a separate parameter is a good idea?

EDIT: Re-tested the command with "--no-input", it does in fact NOT pass a default answer to the prompt. So yeah, I actually think this is a valid feature request. Would love to work on this one, but not really sure how/what steps to do in order to proceed.

Last edited 5 months ago by John Alcher (previous) (diff)

comment:2 Changed 5 months ago by Mariusz Felisiak

Resolution: wontfix
Status: newclosed
Summary: Can "Do you rename" questioner can be executed with a default or optional parameter (y/N) ?Add an option with default answer for makemigrations questions.

Thanks for this ticket, however I don't see a need for a new option. If you really want to answer yes to all the questions, you can use a separate command e.g. yes on Linux

$ yes | django-admin makemigrations 

comment:3 Changed 5 months ago by liudaoqiangtj

Thank you for your immediate relpy, I really appreciate it.
I am in a mini team and a initial project, we use a excel file and a python script to auto edit models.py , aims to manage our database tables and fields.
In the present condition, it can be efficient for us to make "python manage.py makemigrations (and migrate)" automaticly on the server , and another benefit is that it helps to avoid some migration conflicts.

Note: See TracTickets for help on using tickets.
Back to Top