diff --git a/database/migrations/2017_02_09_174834_SetupPermissionsPivotTable.php b/database/migrations/2017_02_09_174834_SetupPermissionsPivotTable.php index ca2cabfd67..2c16118d42 100644 --- a/database/migrations/2017_02_09_174834_SetupPermissionsPivotTable.php +++ b/database/migrations/2017_02_09_174834_SetupPermissionsPivotTable.php @@ -31,6 +31,9 @@ public function up(): void $table->dropIndex('permissions_server_id_foreign'); $table->dropForeign('permissions_user_id_foreign'); $table->dropIndex('permissions_user_id_foreign'); + } else { + $table->dropForeign(['server_id']); + $table->dropForeign(['user_id']); } $table->dropColumn('server_id'); diff --git a/database/migrations/2020_09_13_110007_drop_packs_from_servers.php b/database/migrations/2020_09_13_110007_drop_packs_from_servers.php index cc2695eddd..39f048b373 100644 --- a/database/migrations/2020_09_13_110007_drop_packs_from_servers.php +++ b/database/migrations/2020_09_13_110007_drop_packs_from_servers.php @@ -12,10 +12,7 @@ public function up(): void { Schema::table('servers', function (Blueprint $table) { - if (Schema::getConnection()->getDriverName() !== 'sqlite') { - $table->dropForeign(['pack_id']); - } - + $table->dropForeign(['pack_id']); $table->dropColumn('pack_id'); }); } diff --git a/database/migrations/2024_03_12_154408_remove_nests_table.php b/database/migrations/2024_03_12_154408_remove_nests_table.php index cc95a5f8e1..42d1315b91 100644 --- a/database/migrations/2024_03_12_154408_remove_nests_table.php +++ b/database/migrations/2024_03_12_154408_remove_nests_table.php @@ -30,14 +30,15 @@ public function up(): void Schema::table('eggs', function (Blueprint $table) { if (Schema::getConnection()->getDriverName() !== 'sqlite') { $table->dropForeign('service_options_nest_id_foreign'); + } else { + $table->dropForeign(['nest_id']); } + $table->dropColumn('nest_id'); }); Schema::table('servers', function (Blueprint $table) { - if (Schema::getConnection()->getDriverName() !== 'sqlite') { - $table->dropForeign('servers_nest_id_foreign'); - } + $table->dropForeign(['nest_id']); $table->dropColumn('nest_id'); }); diff --git a/database/migrations/2024_03_14_055537_remove_locations_table.php b/database/migrations/2024_03_14_055537_remove_locations_table.php index f06ded66fd..bdd0c382ad 100644 --- a/database/migrations/2024_03_14_055537_remove_locations_table.php +++ b/database/migrations/2024_03_14_055537_remove_locations_table.php @@ -27,10 +27,7 @@ public function up(): void } Schema::table('nodes', function (Blueprint $table) { - if (Schema::getConnection()->getDriverName() !== 'sqlite') { - $table->dropForeign('nodes_location_id_foreign'); - } - + $table->dropForeign(['location_id']); $table->dropColumn('location_id'); }); diff --git a/database/migrations/2024_09_18_043350_modify_allocations.php b/database/migrations/2024_09_18_043350_modify_allocations.php index 418b26ed96..92e59495e3 100644 --- a/database/migrations/2024_09_18_043350_modify_allocations.php +++ b/database/migrations/2024_09_18_043350_modify_allocations.php @@ -43,15 +43,8 @@ public function up(): void $server->save(); } - try { - Schema::table('servers', function (Blueprint $table) { - $table->dropForeign(['allocation_id']); - }); - } catch (Throwable) { - // pass for databases that don't support this like sqlite - } - Schema::table('servers', function (Blueprint $table) { + $table->dropForeign(['allocation_id']); $table->dropUnique(['allocation_id']); $table->dropColumn(['allocation_id']); });