瀏覽代碼

Update migration, fixes #4863

Daniel Supernault 1 年之前
父節點
當前提交
979aa55135
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      database/migrations/2024_01_09_052419_create_parental_controls_table.php

+ 5 - 1
database/migrations/2024_01_09_052419_create_parental_controls_table.php

@@ -25,7 +25,11 @@ return new class extends Migration
         });
 
         Schema::table('user_roles', function (Blueprint $table) {
-            $table->dropIndex('user_roles_profile_id_unique');
+            $schemaManager = Schema::getConnection()->getDoctrineSchemaManager();
+            $indexesFound  = $schemaManager->listTableIndexes('user_roles');
+            if (array_key_exists('user_roles_profile_id_unique', $indexesFound)) {
+                $table->dropIndex('user_roles_profile_id_unique');
+            }
             $table->unsignedBigInteger('profile_id')->unique()->nullable()->index()->change();
         });
     }