Add id to migrations table (#2794)

This commit is contained in:
Alexander Skvortsov 2021-04-19 10:35:21 -04:00 committed by GitHub
parent c7c456cb3e
commit e77365f32f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,27 @@
<?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Schema\Builder;
return [
'up' => function (Builder $schema) {
if (! $schema->hasColumn('migrations', 'id')) {
$schema->table('migrations', function (Blueprint $table) {
$table->increments('id')->first();
});
}
},
'down' => function (Builder $schema) {
$schema->table('migrations', function (Blueprint $table) {
$table->dropColumn('id');
});
}
];

View File

@ -98,6 +98,7 @@ class DatabaseMigrationRepository implements MigrationRepositoryInterface
$schema = $this->connection->getSchemaBuilder();
$schema->create($this->table, function ($table) {
$table->increments('id');
$table->string('migration');
$table->string('extension')->nullable();
});