Django | 模型類變動後生成遷移文件,報錯:You are trying to add a non-nullable field 'BookName' to BookInfo without a

報錯:ide

You are trying to add a non-nullable field 'BookName' to BookInfo without a default; we can't do that (the database needs something to populate existing rows).ui

Please select a fix:spa

 1) Provide a one-off default now (will be set on all existing rows)it

 2) Quit, and let me add a default in models.pyclass

 

緣由:select

在模型類中添加了一個非空字段,而該模型類對應的表中,已經存在數據,而這些現存的數據並無新增字段的值model

相關文章
相關標籤/搜索