From fdcb78a48c1ad7ab4b30557c632c7f3fa9b89f90 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Wed, 1 Aug 2018 13:24:55 +0930 Subject: [PATCH] Change TIMESTAMP columns to DATETIME manually --- ...e_registration_tokens_created_at_to_datetime.php | 13 +++++++------ ...0_change_email_tokens_created_at_to_datetime.php | 13 +++++++------ ...hange_password_tokens_created_at_to_datetime.php | 13 +++++++------ 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/framework/core/migrations/2018_01_11_102100_change_registration_tokens_created_at_to_datetime.php b/framework/core/migrations/2018_01_11_102100_change_registration_tokens_created_at_to_datetime.php index 7a5dc8cf6..392950d34 100644 --- a/framework/core/migrations/2018_01_11_102100_change_registration_tokens_created_at_to_datetime.php +++ b/framework/core/migrations/2018_01_11_102100_change_registration_tokens_created_at_to_datetime.php @@ -14,14 +14,15 @@ use Illuminate\Database\Schema\Builder; return [ 'up' => function (Builder $schema) { - $schema->table('registration_tokens', function (Blueprint $table) { - $table->dateTime('created_at')->change(); - }); + // do this manually because dbal doesn't recognize timestamp columns + $connection = $schema->getConnection(); + $prefix = $connection->getTablePrefix(); + $connection->statement("ALTER TABLE {$prefix}registration_tokens MODIFY created_at DATETIME"); }, 'down' => function (Builder $schema) { - $schema->table('registration_tokens', function (Blueprint $table) { - $table->timestamp('created_at')->change(); - }); + $connection = $schema->getConnection(); + $prefix = $connection->getTablePrefix(); + $connection->statement("ALTER TABLE {$prefix}registration_tokens MODIFY created_at TIMESTAMP"); } ]; diff --git a/framework/core/migrations/2018_01_15_072800_change_email_tokens_created_at_to_datetime.php b/framework/core/migrations/2018_01_15_072800_change_email_tokens_created_at_to_datetime.php index 7a4c8e218..f075a44f7 100644 --- a/framework/core/migrations/2018_01_15_072800_change_email_tokens_created_at_to_datetime.php +++ b/framework/core/migrations/2018_01_15_072800_change_email_tokens_created_at_to_datetime.php @@ -14,14 +14,15 @@ use Illuminate\Database\Schema\Builder; return [ 'up' => function (Builder $schema) { - $schema->table('email_tokens', function (Blueprint $table) { - $table->dateTime('created_at')->change(); - }); + // do this manually because dbal doesn't recognize timestamp columns + $connection = $schema->getConnection(); + $prefix = $connection->getTablePrefix(); + $connection->statement("ALTER TABLE {$prefix}email_tokens MODIFY created_at DATETIME"); }, 'down' => function (Builder $schema) { - $schema->table('email_tokens', function (Blueprint $table) { - $table->timestamp('created_at')->change(); - }); + $connection = $schema->getConnection(); + $prefix = $connection->getTablePrefix(); + $connection->statement("ALTER TABLE {$prefix}email_tokens MODIFY created_at TIMESTAMP"); } ]; diff --git a/framework/core/migrations/2018_01_18_134600_change_password_tokens_created_at_to_datetime.php b/framework/core/migrations/2018_01_18_134600_change_password_tokens_created_at_to_datetime.php index f552e9cf9..c65ac98e2 100644 --- a/framework/core/migrations/2018_01_18_134600_change_password_tokens_created_at_to_datetime.php +++ b/framework/core/migrations/2018_01_18_134600_change_password_tokens_created_at_to_datetime.php @@ -14,14 +14,15 @@ use Illuminate\Database\Schema\Builder; return [ 'up' => function (Builder $schema) { - $schema->table('password_tokens', function (Blueprint $table) { - $table->dateTime('created_at')->change(); - }); + // do this manually because dbal doesn't recognize timestamp columns + $connection = $schema->getConnection(); + $prefix = $connection->getTablePrefix(); + $connection->statement("ALTER TABLE {$prefix}password_tokens MODIFY created_at DATETIME"); }, 'down' => function (Builder $schema) { - $schema->table('password_tokens', function (Blueprint $table) { - $table->timestamp('created_at')->change(); - }); + $connection = $schema->getConnection(); + $prefix = $connection->getTablePrefix(); + $connection->statement("ALTER TABLE {$prefix}password_tokens MODIFY created_at TIMESTAMP"); } ];