Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

执行php artisan migrate --seed的时候报错 #154

Open
calcyu opened this issue Mar 19, 2016 · 1 comment
Open

执行php artisan migrate --seed的时候报错 #154

calcyu opened this issue Mar 19, 2016 · 1 comment

Comments

@calcyu
Copy link

calcyu commented Mar 19, 2016

[Illuminate\Database\QueryException]
SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default val
ue for 'created_at' (SQL: create table site_statuses (id int unsigned n
ot null auto_increment primary key, day varchar(255) not null, created_a t 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 val
ue for 'created_at'

@calcyu
Copy link
Author

calcyu commented Mar 19, 2016

把以往问题看了一遍,找到了答案

database.php里面添加'strict'=>true

'mysql' => array(
'driver' => 'mysql',
'host' => getenv('DB_HOST') ?: 'localhost',
'database' => getenv('DB_NAME') ?: 'phphub',
'username' => getenv('DB_USERNAME') ?: 'root',
'password' => getenv('DB_PASSWORD') ?: '',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => true,

    ),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant