diff --git a/database/migrations/2016_01_23_195641_add_allocations_table.php b/database/migrations/2016_01_23_195641_add_allocations_table.php index 2edec4485..7384b7de2 100644 --- a/database/migrations/2016_01_23_195641_add_allocations_table.php +++ b/database/migrations/2016_01_23_195641_add_allocations_table.php @@ -29,6 +29,6 @@ class AddAllocationsTable extends Migration */ public function down() { - Schema::dropIfExsits('allocations'); + Schema::dropIfExists('allocations'); } } diff --git a/database/migrations/2016_01_23_200421_create_failed_jobs_table.php b/database/migrations/2016_01_23_200421_create_failed_jobs_table.php index c1ba41b48..63eaf53a6 100644 --- a/database/migrations/2016_01_23_200421_create_failed_jobs_table.php +++ b/database/migrations/2016_01_23_200421_create_failed_jobs_table.php @@ -28,6 +28,6 @@ class CreateFailedJobsTable extends Migration */ public function down() { - Schema::drop('failed_jobs'); + Schema::dropIfExists('failed_jobs'); } } diff --git a/database/migrations/2016_01_23_200440_create_jobs_table.php b/database/migrations/2016_01_23_200440_create_jobs_table.php index 81b2d29f2..01d3a9e65 100644 --- a/database/migrations/2016_01_23_200440_create_jobs_table.php +++ b/database/migrations/2016_01_23_200440_create_jobs_table.php @@ -32,6 +32,6 @@ class CreateJobsTable extends Migration */ public function down() { - Schema::drop('jobs'); + Schema::dropIfExists('jobs'); } } diff --git a/database/migrations/2016_01_23_201649_add_server_variables.php b/database/migrations/2016_01_23_201649_add_server_variables.php index bfbb4b99d..229b33c60 100644 --- a/database/migrations/2016_01_23_201649_add_server_variables.php +++ b/database/migrations/2016_01_23_201649_add_server_variables.php @@ -28,8 +28,6 @@ class AddServerVariables extends Migration */ public function down() { - Schema::table('server_variables', function (Blueprint $table) { - // - }); + Schema::dropIfExists('server_variables'); } } diff --git a/database/migrations/2016_01_23_202544_add_service_options.php b/database/migrations/2016_01_23_202544_add_service_options.php index 1a05caec8..172f1eb7b 100644 --- a/database/migrations/2016_01_23_202544_add_service_options.php +++ b/database/migrations/2016_01_23_202544_add_service_options.php @@ -30,6 +30,6 @@ class AddServiceOptions extends Migration */ public function down() { - Schema::dropIfExsits('service_options'); + Schema::dropIfExists('service_options'); } } diff --git a/database/migrations/2016_10_23_203857_add_foreign_server_variables.php b/database/migrations/2016_10_23_203857_add_foreign_server_variables.php index c232176c7..af78a161c 100644 --- a/database/migrations/2016_10_23_203857_add_foreign_server_variables.php +++ b/database/migrations/2016_10_23_203857_add_foreign_server_variables.php @@ -32,14 +32,11 @@ class AddForeignServerVariables extends Migration public function down() { Schema::table('server_variables', function (Blueprint $table) { - $table->dropForeign('server_variables_server_id_foreign'); - $table->dropForeign('server_variables_variable_id_foreign'); - - $table->dropIndex('server_variables_server_id_foreign'); - $table->dropIndex('server_variables_variable_id_foreign'); + $table->dropForeign(['server_id']); + $table->dropForeign(['variable_id']); }); - DB::statement('ALTER TABLE allocations + DB::statement('ALTER TABLE server_variables MODIFY COLUMN server_id MEDIUMINT(8) UNSIGNED NULL, MODIFY COLUMN variable_id MEDIUMINT(8) UNSIGNED NOT NULL '); diff --git a/database/migrations/2016_10_23_204610_add_foreign_tasks.php b/database/migrations/2016_10_23_204610_add_foreign_tasks.php index 77b736201..3821caffc 100644 --- a/database/migrations/2016_10_23_204610_add_foreign_tasks.php +++ b/database/migrations/2016_10_23_204610_add_foreign_tasks.php @@ -26,11 +26,7 @@ class AddForeignTasks extends Migration public function down() { Schema::table('tasks', function (Blueprint $table) { - $table->dropForeign('tasks_server_foreign'); - $table->dropForeign('tasks_server_foreign'); - - $table->dropIndex('tasks_server_foreign'); - $table->dropIndex('tasks_server_foreign'); + $table->dropForeign(['server']); }); } } diff --git a/database/migrations/2016_11_27_142519_add_pack_column.php b/database/migrations/2016_11_27_142519_add_pack_column.php index f2c2f0964..4e3507c39 100644 --- a/database/migrations/2016_11_27_142519_add_pack_column.php +++ b/database/migrations/2016_11_27_142519_add_pack_column.php @@ -28,8 +28,7 @@ class AddPackColumn extends Migration public function down() { Schema::table('servers', function (Blueprint $table) { - $table->dropForeign('servers_pack_foreign'); - $table->dropIndex('servers_pack_foreign'); + $table->dropForeign(['pack']); $table->dropColumn('pack'); }); } diff --git a/database/migrations/2017_02_02_175548_UpdateColumnNames.php b/database/migrations/2017_02_02_175548_UpdateColumnNames.php index 800762417..233780bfd 100644 --- a/database/migrations/2017_02_02_175548_UpdateColumnNames.php +++ b/database/migrations/2017_02_02_175548_UpdateColumnNames.php @@ -40,6 +40,9 @@ class UpdateColumnNames extends Migration $table->foreign('allocation_id')->references('id')->on('allocations'); $table->foreign('service_id')->references('id')->on('services'); $table->foreign('option_id')->references('id')->on('service_options'); + + // Pack ID was forgotten until multiple releases later, therefore it is + // contained in '2017_03_18_204953_AddForeignKeyToPacks' }); } @@ -51,19 +54,11 @@ class UpdateColumnNames extends Migration public function down() { Schema::table('servers', function (Blueprint $table) { - $table->dropForeign('servers_node_id_foreign'); - $table->dropForeign('servers_owner_id_foreign'); - $table->dropForeign('servers_allocation_id_foreign'); - $table->dropForeign('servers_service_id_foreign'); - $table->dropForeign('servers_option_id_foreign'); - $table->dropForeign('servers_pack_id_foreign'); - - $table->dropIndex('servers_node_id_foreign'); - $table->dropIndex('servers_owner_id_foreign'); - $table->dropIndex('servers_allocation_id_foreign'); - $table->dropIndex('servers_service_id_foreign'); - $table->dropIndex('servers_option_id_foreign'); - $table->dropIndex('servers_pack_id_foreign'); + $table->dropForeign(['node_id']); + $table->dropForeign(['owner_id']); + $table->dropForeign(['allocation_id']); + $table->dropForeign(['service_id']); + $table->dropForeign(['option_id']); $table->renameColumn('node_id', 'node'); $table->renameColumn('owner_id', 'owner'); @@ -77,6 +72,7 @@ class UpdateColumnNames extends Migration $table->foreign('allocation')->references('id')->on('allocations'); $table->foreign('service')->references('id')->on('services'); $table->foreign('option')->references('id')->on('service_options'); + $table->foreign('pack')->references('id')->on('service_packs'); }); } } diff --git a/database/migrations/2017_03_10_162934_AddNewServiceOptionsColumns.php b/database/migrations/2017_03_10_162934_AddNewServiceOptionsColumns.php index f2c50cdd7..351327d3c 100644 --- a/database/migrations/2017_03_10_162934_AddNewServiceOptionsColumns.php +++ b/database/migrations/2017_03_10_162934_AddNewServiceOptionsColumns.php @@ -34,7 +34,7 @@ class AddNewServiceOptionsColumns extends Migration public function down() { Schema::table('service_options', function (Blueprint $table) { - $table->dropForeign('config_from'); + $table->dropForeign(['config_from']); $table->dropColumn('config_from'); $table->dropColumn('config_stop');