php – 语法错误或访问冲突:1067“created_at”的默认值无效
我安装laravel 5.5并且当我运行php artisan migrate时显示我的错误
我在AppServiceProvider.php上添加了以下代码 public function boot() { Schema::defaultStringLength(191); //Solved by increasing StringLength } 然后告诉我这个错误
解决方法
你可以使用nullableTimestamps()而不是timestamps()
要么 $table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP')); 请查看以下参考链接: https://github.com/laravel/framework/issues/3602 https://laracasts.com/discuss/channels/forge/syntax-error-or-access-violation-1067-invalid-default-value-for-created-at (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |