Skip to content

A free open source IT asset/license management system

Fixed #10892 - MySQL 8 compatibilty requires primary key

snipec12ef19fcc9c
diff --git a/database/migrations/2022_04_05_135340_add_primary_key_to_custom_fields_pivot.php b/database/migrations/2022_04_05_135340_add_primary_key_to_custom_fields_pivot.php
new file mode 100644
index 0000000000..44a879b1ee
--- /dev/null
+++ b/database/migrations/2022_04_05_135340_add_primary_key_to_custom_fields_pivot.php
@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddPrimaryKeyToCustomFieldsPivot extends Migration
+{
+ /**
+ * Run the migrations.
+ *
+ * @return void
+ */
+ public function up()
+ {
+ Schema::table('custom_field_custom_fieldset', function (Blueprint $table) {
+ $table->bigIncrements('id')->first();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::table('custom_field_custom_fieldset', function (Blueprint $table) {
+ if (Schema::hasColumn('custom_field_custom_fieldset', 'id')) {
+ $table->dropColumn('id');
+ }
+ });
+ }
+}