Use new shortcuts for migrations

This commit is contained in:
Franz Liedke 2016-02-29 23:42:48 +09:00
parent ec0054cace
commit d240d4c0ff
2 changed files with 18 additions and 28 deletions

View File

@ -8,19 +8,14 @@
* 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) { 'discussions_tags',
$schema->create('discussions_tags', function (Blueprint $table) { function (Blueprint $table) {
$table->integer('discussion_id')->unsigned(); $table->integer('discussion_id')->unsigned();
$table->integer('tag_id')->unsigned(); $table->integer('tag_id')->unsigned();
$table->primary(['discussion_id', 'tag_id']); $table->primary(['discussion_id', 'tag_id']);
});
},
'down' => function (Builder $schema) {
$schema->drop('discussions_tags');
} }
]; );

View File

@ -8,21 +8,16 @@
* 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) { 'users_tags',
$schema->create('users_tags', function (Blueprint $table) { function (Blueprint $table) {
$table->integer('user_id')->unsigned(); $table->integer('user_id')->unsigned();
$table->integer('tag_id')->unsigned(); $table->integer('tag_id')->unsigned();
$table->dateTime('read_time')->nullable(); $table->dateTime('read_time')->nullable();
$table->boolean('is_hidden')->default(0); $table->boolean('is_hidden')->default(0);
$table->primary(['user_id', 'tag_id']); $table->primary(['user_id', 'tag_id']);
});
},
'down' => function (Builder $schema) {
$schema->drop('users_tags');
} }
]; );