django makemigrations to rename field without user input

孤街醉人 提交于 2020-04-19 07:54:09

问题


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

When I run python manage.py 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.


回答1:


Use

script_or_command < <(yes y)

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



来源:https://stackoverflow.com/questions/39866339/django-makemigrations-to-rename-field-without-user-input

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!