问题描述
我有一个带有CharField的模型,名为 oldName 。我想将该字段重命名为 newName 。当我运行 python manage.py makemigrations 时,我收到确认请求您是否将model.oldName重命名为model.newName (一个CharField)?[y / N]
然而,我想在Docker容器内运行整个事情,没有条款提供用户输入。有没有办法强制迁移而不需要用户输入?
PS:我试过 - noinput 选项与makemigrations。在这种情况下,迁移没有得到应用。
使用
script_or_command< <(yes y)
但我不知道这对多个输入提示有帮助。 / p>
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.
Use
script_or_command < <(yes y)
But I'm not sure this will work for multiple input prompts.
这篇关于django makemigrations重命名字段没有用户输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!