diff --git a/database/migrations/2024_01_09_052419_create_parental_controls_table.php b/database/migrations/2024_01_09_052419_create_parental_controls_table.php index 4ef7fd2c7..bf803e4c0 100644 --- a/database/migrations/2024_01_09_052419_create_parental_controls_table.php +++ b/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(); }); }