Migration isn’t running correctly :/
Schema::create('player_password_reset_links', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('player_id');
$table->string('token');
$table->timestamp('created_at');
$table->timestamp('expires_at');
$table->timestamp('used_at')->nullable();
$table
->foreign('player_id')
->references('id')
->on('players');
});
I get
SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid
default value for ‘expires_at’ (SQL: create table
player_password_reset_links
(id
bigint unsigned not null
auto_increment primary key,player_id
bigint unsigned not null,
token
varchar(255) not null,created_at
timestamp not null,
expires_at
timestamp not null,used_at
timestamp null) default
character set utf8mb4 collate ‘utf8mb4_unicode_ci’)
I’ve tried doing it after like so
DB::statement('alter table player_password_reset_links add expires_at timestamp not null after created_at;');
But this results in
SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid
default value for ‘expires_at’ (SQL: alter table
player_password_reset_links add expires_at timestamp not null after
created_at;)
If I run this query in MySQL its fine, what is Laravel doing differently?