Mysql2::Error: All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead

前端 未结 4 1746
我寻月下人不归
我寻月下人不归 2021-02-01 09:38

I have created a demo application in rails 3.2.9 and ruby versiion 2.0.0 . After scaffolding Blog model I am trying to migrate it, but having following

4条回答
  •  醉梦人生
    2021-02-01 10:11

    This error occurred when not null is defined with primary key column.

    Even if you defined any composite key, then those column definition does not contains the not null criteria.

    Search for those column, remove the not null criteria, this is one of the solution to remove the error.

提交回复
热议问题