给已经生成的表新增外键关联字段,执行数据库迁移的时候报错:
python manage.py makemigrations
It is impossible to add a non-nullable field 'project' to config without specifying a default. This is because the database needs something to populate existing rows.
Please select a fix:
1) Provide a one-off default now (will be set on all existing rows with a null value for this column)
2) Quit and manually define a default value in models.py.
在新增的字段后加一个缺省:如default=“”,重新执行即可