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

相关文章
相关标签/搜索