Some version DB's dont like the usual $table->timestamps() fields Try the $table->nullableTimestamps() they should work.
The difference is that the nullableTimestamps have a default value of NULL ;)
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I recently setup a new php7 server with digital ocean, and forge, and envoyer.. When I came to deploy my code it fails during the migrations.
All of the migrations fail to run due to the default value for timestamps. They're set to 0000-00-00 00:00:00 which apparently MySQL doesn't like (assuming due to strict mode).
My migration looks like this:
Schema::create('checks', function (Blueprint $table) {
$table->increments('id');
$table->string('hash');
$table->string('domain')->index();
$table->string('host')->index();
$table->timestamps();
$table->softDeletes();
});
Error is:
SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'created_at'
I'm running Laravel 5.1, if that makes any difference. How could I go about fixing this?
Also, it works fine within Homestead, and on my old php 5.6 server. It's just the new one which doesn't work :/
Some version DB's dont like the usual $table->timestamps() fields Try the $table->nullableTimestamps() they should work.
The difference is that the nullableTimestamps have a default value of NULL ;)
Please or to participate in this conversation.