From badd2abff4602b6273a2820d74b49e6bbc6ff939 Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Fri, 4 Mar 2016 01:11:25 +0900 Subject: [PATCH] Use new shortcuts for migrations --- ...000_add_flags_read_time_to_users_table.php | 17 +++-------- .../2015_09_02_000000_create_flags_table.php | 29 ++++++++----------- 2 files changed, 16 insertions(+), 30 deletions(-) diff --git a/extensions/flags/migrations/2015_09_02_000000_add_flags_read_time_to_users_table.php b/extensions/flags/migrations/2015_09_02_000000_add_flags_read_time_to_users_table.php index c00faa5c2..dde1f5f46 100644 --- a/extensions/flags/migrations/2015_09_02_000000_add_flags_read_time_to_users_table.php +++ b/extensions/flags/migrations/2015_09_02_000000_add_flags_read_time_to_users_table.php @@ -8,17 +8,8 @@ * file that was distributed with this source code. */ -use Illuminate\Database\Schema\Blueprint; -use Illuminate\Database\Schema\Builder; +use Flarum\Database\Migration; -return [ - 'up' => function (Builder $schema) { - $schema->table('users', function (Blueprint $table) { - $table->dateTime('flags_read_time')->nullable(); - }); - }, - - 'down' => function (Builder $schema) { - $schema->drop('flags_read_time'); - } -]; +return Migration::addColumns('users', [ + 'flags_read_time' => ['dateTime', 'nullable' => true] +]); diff --git a/extensions/flags/migrations/2015_09_02_000000_create_flags_table.php b/extensions/flags/migrations/2015_09_02_000000_create_flags_table.php index 13088e751..b06b8864e 100644 --- a/extensions/flags/migrations/2015_09_02_000000_create_flags_table.php +++ b/extensions/flags/migrations/2015_09_02_000000_create_flags_table.php @@ -8,23 +8,18 @@ * file that was distributed with this source code. */ +use Flarum\Database\Migration; use Illuminate\Database\Schema\Blueprint; -use Illuminate\Database\Schema\Builder; -return [ - 'up' => function (Builder $schema) { - $schema->create('flags', function (Blueprint $table) { - $table->increments('id'); - $table->integer('post_id')->unsigned(); - $table->string('type'); - $table->integer('user_id')->unsigned()->nullable(); - $table->string('reason')->nullable(); - $table->string('reason_detail')->nullable(); - $table->dateTime('time'); - }); - }, - - 'down' => function (Builder $schema) { - $schema->drop('flags'); +return Migration::createTable( + 'flags', + function (Blueprint $table) { + $table->increments('id'); + $table->integer('post_id')->unsigned(); + $table->string('type'); + $table->integer('user_id')->unsigned()->nullable(); + $table->string('reason')->nullable(); + $table->string('reason_detail')->nullable(); + $table->dateTime('time'); } -]; +);