From 89db9390df4492691b917b3c803e5d3f79f12462 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sun, 4 Mar 2018 15:21:54 -0600 Subject: [PATCH] Fix broken migration rollbacks --- database/migrations/2017_04_15_125021_UpgradeTaskSystem.php | 4 ++-- ...017_07_24_194433_DeleteTaskWhenParentServerIsDeleted.php | 6 +----- .../2018_01_11_213943_AddApiKeyPermissionColumns.php | 2 +- ..._134254_ensure_unique_allocation_id_on_servers_table.php | 3 +++ 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/database/migrations/2017_04_15_125021_UpgradeTaskSystem.php b/database/migrations/2017_04_15_125021_UpgradeTaskSystem.php index dc58df4d9..d069e1ba1 100644 --- a/database/migrations/2017_04_15_125021_UpgradeTaskSystem.php +++ b/database/migrations/2017_04_15_125021_UpgradeTaskSystem.php @@ -36,8 +36,8 @@ class UpgradeTaskSystem extends Migration public function down() { Schema::table('tasks', function (Blueprint $table) { - $table->dropForeign(['server_id']); - $table->dropForeign(['user_id']); +// $table->dropForeign(['server_id']); +// $table->dropForeign(['user_id']); $table->renameColumn('server_id', 'server'); $table->dropColumn('user_id'); diff --git a/database/migrations/2017_07_24_194433_DeleteTaskWhenParentServerIsDeleted.php b/database/migrations/2017_07_24_194433_DeleteTaskWhenParentServerIsDeleted.php index 88e2e0135..042e7564c 100644 --- a/database/migrations/2017_07_24_194433_DeleteTaskWhenParentServerIsDeleted.php +++ b/database/migrations/2017_07_24_194433_DeleteTaskWhenParentServerIsDeleted.php @@ -23,10 +23,6 @@ class DeleteTaskWhenParentServerIsDeleted extends Migration */ public function down() { - Schema::table('tasks', function (Blueprint $table) { - $table->dropForeign(['server_id']); - - $table->foreign('server_id')->references('id')->on('servers'); - }); + // } } diff --git a/database/migrations/2018_01_11_213943_AddApiKeyPermissionColumns.php b/database/migrations/2018_01_11_213943_AddApiKeyPermissionColumns.php index cd6b60e10..adc6d2648 100644 --- a/database/migrations/2018_01_11_213943_AddApiKeyPermissionColumns.php +++ b/database/migrations/2018_01_11_213943_AddApiKeyPermissionColumns.php @@ -41,7 +41,7 @@ class AddApiKeyPermissionColumns extends Migration $table->unsignedInteger('key_id'); $table->string('permission'); - $table->foreign('key_id')->references('id')->on('keys')->onDelete('cascade'); + $table->foreign('key_id')->references('id')->on('api_keys')->onDelete('cascade'); }); Schema::table('api_keys', function (Blueprint $table) { diff --git a/database/migrations/2018_02_17_134254_ensure_unique_allocation_id_on_servers_table.php b/database/migrations/2018_02_17_134254_ensure_unique_allocation_id_on_servers_table.php index fcf6b4fe3..bff7bbfb0 100644 --- a/database/migrations/2018_02_17_134254_ensure_unique_allocation_id_on_servers_table.php +++ b/database/migrations/2018_02_17_134254_ensure_unique_allocation_id_on_servers_table.php @@ -26,7 +26,10 @@ class EnsureUniqueAllocationIdOnServersTable extends Migration public function down() { Schema::table('servers', function (Blueprint $table) { + $table->dropForeign(['allocation_id']); $table->dropUnique(['allocation_id']); + + $table->foreign('allocation_id')->references('id')->on('allocations'); }); } }