我正在尝试在我的 Laravel 实例上运行迁移。它们只是默认迁移(用户和密码重置),但是当它尝试制作时间戳时会抛出此错误:
[Illuminate\Database\QueryException]
SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'created_at' (SQL: create table `
users` (`id` int unsigned not null auto_increment primary key, `name` varchar(255) not null, `email` varchar(255) n
ot null, `password` varchar(60) not null, `remember_token` varchar(100) null, `created_at` timestamp default 0 not
null, `updated_at` timestamp default 0 not null) default character set utf8 collate utf8_unicode_ci)
还有一个 PDOException:
SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'created_at'
我该如何解决这个问题?
谢谢。
最佳答案
我一直面临同样的错误。鉴于解决方案确实可以正常工作,我仍然想帮助 laravel 开发人员。 只需将以下行添加到 config/database.php
'mysql' => array(
'strict' => true
),
关于php - Laravel 迁移 - 创建时间戳时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30555844/