Krishna Kishore Andhavarapu Krishna Kishore Andhavarapu - 1 year ago 143
Python Question

django makemigrations to rename field without user input

I have a model with CharField named oldName. I want to rename the field to newName.

When I run python makemigrations, I get a confirmation request "Did you rename model.oldName to model.newName (a CharField)? [y/N]"

However, I want to run the whole thing inside a docker container and there is no provision to provide the user input. Is there a way to force the migration without need for user input?

PS: I tried --noinput option with makemigrations. In this case migrations are not getting applied.

Answer Source


script_or_command < <(yes y)

But I'm not sure this will work for multiple input prompts.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download