A free open source IT asset/license management system
Adds ID columns to tables that don’t have them - reproduces #9363
snipe39b0f464d2bf
diff --git a/database/migrations/2021_04_14_180125_add_ids_to_tables.php b/database/migrations/2021_04_14_180125_add_ids_to_tables.phpnew file mode 100644index 0000000000..22cf03ebf9--- /dev/null+++ b/database/migrations/2021_04_14_180125_add_ids_to_tables.php@@ -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');+ }+ });+ }+}