Syntax error or access violation: 1067 Invalid default value for 'created_at'

my case

        $table->timestamp('deleted_at')->nullable()->default(null);

this worked


You can use nullableTimestamps() instead of timestamps()

or

$table->timestamp('created_at')->default(\DB::raw('CURRENT_TIMESTAMP'));

also check the database server version

Please have a look on these ref links:

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


I'm currently using laravel 7.

I just go to config/database.php

Then I change strict => true to strict => false.

Then run the same migration again. It works.