Use new shortcuts for migrations

This commit is contained in:
Franz Liedke 2016-03-04 01:12:58 +09:00
parent 5d3b0f6f10
commit 3a2699a7bf
2 changed files with 6 additions and 30 deletions

View File

@ -8,19 +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) { 'suspended_until' => ['dateTime', 'nullable' => true]
$schema->table('users', function (Blueprint $table) { ]);
$table->dateTime('suspended_until')->nullable();
});
},
'down' => function (Builder $schema) {
$schema->table('users', function (Blueprint $table) {
$table->dropColumn('suspended_until');
});
}
];

View File

@ -8,19 +8,6 @@
* 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::renameColumn('users', 'suspended_until', 'suspend_until');
'up' => function (Builder $schema) {
$schema->table('users', function (Blueprint $table) {
$table->renameColumn('suspended_until', 'suspend_until');
});
},
'down' => function (Builder $schema) {
$schema->table('users', function (Blueprint $table) {
$table->renameColumn('suspend_until', 'suspended_until');
});
}
];