1
0
mirror of https://github.com/flarum/core.git synced 2025-08-05 07:57:46 +02:00

Use new shortcuts for migrations

This commit is contained in:
Franz Liedke
2016-03-04 01:11:25 +09:00
parent 751afe218c
commit badd2abff4
2 changed files with 16 additions and 30 deletions

View File

@@ -8,17 +8,8 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
use Illuminate\Database\Schema\Blueprint; use Flarum\Database\Migration;
use Illuminate\Database\Schema\Builder;
return [ return Migration::addColumns('users', [
'up' => function (Builder $schema) { 'flags_read_time' => ['dateTime', 'nullable' => true]
$schema->table('users', function (Blueprint $table) { ]);
$table->dateTime('flags_read_time')->nullable();
});
},
'down' => function (Builder $schema) {
$schema->drop('flags_read_time');
}
];

View File

@@ -8,23 +8,18 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
use Flarum\Database\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Schema\Builder;
return [ return Migration::createTable(
'up' => function (Builder $schema) { 'flags',
$schema->create('flags', function (Blueprint $table) { function (Blueprint $table) {
$table->increments('id'); $table->increments('id');
$table->integer('post_id')->unsigned(); $table->integer('post_id')->unsigned();
$table->string('type'); $table->string('type');
$table->integer('user_id')->unsigned()->nullable(); $table->integer('user_id')->unsigned()->nullable();
$table->string('reason')->nullable(); $table->string('reason')->nullable();
$table->string('reason_detail')->nullable(); $table->string('reason_detail')->nullable();
$table->dateTime('time'); $table->dateTime('time');
});
},
'down' => function (Builder $schema) {
$schema->drop('flags');
} }
]; );