Use new migration format

This commit is contained in:
Franz Liedke 2016-02-24 23:12:36 +09:00
parent d30a0a7d59
commit e62dd6a3a1
2 changed files with 16 additions and 26 deletions

View File

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

View File

@ -8,16 +8,12 @@
* file that was distributed with this source code.
*/
namespace Flarum\Flags\Migration;
use Flarum\Database\AbstractMigration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Schema\Builder;
class CreateFlagsTable extends AbstractMigration
{
public function up()
{
$this->schema->create('flags', function (Blueprint $table) {
return [
'up' => function (Builder $schema) {
$schema->create('flags', function (Blueprint $table) {
$table->increments('id');
$table->integer('post_id')->unsigned();
$table->string('type');
@ -26,10 +22,9 @@ class CreateFlagsTable extends AbstractMigration
$table->string('reason_detail')->nullable();
$table->dateTime('time');
});
}
},
public function down()
{
$this->schema->drop('flags');
'down' => function (Builder $schema) {
$schema->drop('flags');
}
}
];