Tag: insert into

Rails 3.2 + MySQL:错误:字段’created_at’没有默认值:INSERT INTO

我创建了一个新的迁移,其中提到了 … t.timestamps 在创建的表中添加了这两列 … | created_at | datetime | NO (Null) | | NULL (Default) | | updated_at | datetime | NO (Null) | | NULL (Default) | … 当我想创建一个新项目时,我总是收到错误消息 Mysql2::Error: Field ‘created_at’ doesn’t have a default value: INSERT INTO `table_name` (`first_col`, `second_col`) VALUES (‘a’, ‘b’) 我错过了什么吗? 我把这个miniapp发送给我的一个朋友,他能够成功运行它 – >记录是在数据库中创建的。 我错过了什么?