diff --git a/framework/core/migrations/2021_04_18_040500_change_migrations_add_id_primary_key.php b/framework/core/migrations/2021_04_18_040500_change_migrations_add_id_primary_key.php new file mode 100644 index 000000000..2f9c6d9ae --- /dev/null +++ b/framework/core/migrations/2021_04_18_040500_change_migrations_add_id_primary_key.php @@ -0,0 +1,27 @@ + 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'); + }); + } +]; diff --git a/framework/core/src/Database/DatabaseMigrationRepository.php b/framework/core/src/Database/DatabaseMigrationRepository.php index f3a733ffe..cadc5f8c0 100644 --- a/framework/core/src/Database/DatabaseMigrationRepository.php +++ b/framework/core/src/Database/DatabaseMigrationRepository.php @@ -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(); });