mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Adds ID columns to tables that don’t have them - reproduces #9363
This reproduces #9363 without the PK in custom fields Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
2c0438bdcb
commit
39b0f464d2
54
database/migrations/2021_04_14_180125_add_ids_to_tables.php
Normal file
54
database/migrations/2021_04_14_180125_add_ids_to_tables.php
Normal file
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddIdsToTables extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
|
||||
Schema::table('migrations', function (Blueprint $table) {
|
||||
// Add the id column to the migrations table if it doesn't yet have one
|
||||
if (!Schema::hasColumn('migrations', 'id')) {
|
||||
$table->increments('id');
|
||||
}
|
||||
});
|
||||
|
||||
Schema::table('password_resets', function (Blueprint $table) {
|
||||
// Add the id column to the password_resets table if it doesn't yet have one
|
||||
if (!Schema::hasColumn('password_resets', 'id')) {
|
||||
$table->increments('id');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('migrations', function (Blueprint $table) {
|
||||
if (Schema::hasColumn('migrations', 'id')) {
|
||||
$table->dropColumn('id');
|
||||
}
|
||||
});
|
||||
|
||||
Schema::table('password_resets', function (Blueprint $table) {
|
||||
if (Schema::hasColumn('password_resets', 'id')) {
|
||||
$table->dropColumn('id');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue