Krishna Kishore Andhavarapu Krishna Kishore Andhavarapu - 5 months ago 50
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.



script_or_command < <(yes y)

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