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

前端 未结 4 1759
我寻月下人不归
我寻月下人不归 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:07

    In this line id int(11) DEFAULT NULL auto_increment PRIMARY KEY you are creating a primary key (which can never be null), with the default value NULL. In your migration file (or schema.rb) you should make sure the DEFAULT NULL part is removed.

提交回复
热议问题