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.
*/
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]
]);

View File

@ -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');
}
];
);