Skip to content

Commit d695532

Browse files
committed
Fixes migrations to actually rollback all the way.
1 parent 33262cf commit d695532

10 files changed

+20
-34
lines changed

database/migrations/2016_01_23_195641_add_allocations_table.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ public function up()
2929
*/
3030
public function down()
3131
{
32-
Schema::dropIfExsits('allocations');
32+
Schema::dropIfExists('allocations');
3333
}
3434
}

database/migrations/2016_01_23_200421_create_failed_jobs_table.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ public function up()
2828
*/
2929
public function down()
3030
{
31-
Schema::drop('failed_jobs');
31+
Schema::dropIfExists('failed_jobs');
3232
}
3333
}

database/migrations/2016_01_23_200440_create_jobs_table.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ public function up()
3232
*/
3333
public function down()
3434
{
35-
Schema::drop('jobs');
35+
Schema::dropIfExists('jobs');
3636
}
3737
}

database/migrations/2016_01_23_201649_add_server_variables.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ public function up()
2828
*/
2929
public function down()
3030
{
31-
Schema::table('server_variables', function (Blueprint $table) {
32-
//
33-
});
31+
Schema::dropIfExists('server_variables');
3432
}
3533
}

database/migrations/2016_01_23_202544_add_service_options.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ public function up()
3030
*/
3131
public function down()
3232
{
33-
Schema::dropIfExsits('service_options');
33+
Schema::dropIfExists('service_options');
3434
}
3535
}

database/migrations/2016_10_23_203857_add_foreign_server_variables.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,11 @@ public function up()
3232
public function down()
3333
{
3434
Schema::table('server_variables', function (Blueprint $table) {
35-
$table->dropForeign('server_variables_server_id_foreign');
36-
$table->dropForeign('server_variables_variable_id_foreign');
37-
38-
$table->dropIndex('server_variables_server_id_foreign');
39-
$table->dropIndex('server_variables_variable_id_foreign');
35+
$table->dropForeign(['server_id']);
36+
$table->dropForeign(['variable_id']);
4037
});
4138

42-
DB::statement('ALTER TABLE allocations
39+
DB::statement('ALTER TABLE server_variables
4340
MODIFY COLUMN server_id MEDIUMINT(8) UNSIGNED NULL,
4441
MODIFY COLUMN variable_id MEDIUMINT(8) UNSIGNED NOT NULL
4542
');

database/migrations/2016_10_23_204610_add_foreign_tasks.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,7 @@ public function up()
2626
public function down()
2727
{
2828
Schema::table('tasks', function (Blueprint $table) {
29-
$table->dropForeign('tasks_server_foreign');
30-
$table->dropForeign('tasks_server_foreign');
31-
32-
$table->dropIndex('tasks_server_foreign');
33-
$table->dropIndex('tasks_server_foreign');
29+
$table->dropForeign(['server']);
3430
});
3531
}
3632
}

database/migrations/2016_11_27_142519_add_pack_column.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ public function up()
2828
public function down()
2929
{
3030
Schema::table('servers', function (Blueprint $table) {
31-
$table->dropForeign('servers_pack_foreign');
32-
$table->dropIndex('servers_pack_foreign');
31+
$table->dropForeign(['pack']);
3332
$table->dropColumn('pack');
3433
});
3534
}

database/migrations/2017_02_02_175548_UpdateColumnNames.php

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ public function up()
4040
$table->foreign('allocation_id')->references('id')->on('allocations');
4141
$table->foreign('service_id')->references('id')->on('services');
4242
$table->foreign('option_id')->references('id')->on('service_options');
43+
44+
// Pack ID was forgotten until multiple releases later, therefore it is
45+
// contained in '2017_03_18_204953_AddForeignKeyToPacks'
4346
});
4447
}
4548

@@ -51,19 +54,11 @@ public function up()
5154
public function down()
5255
{
5356
Schema::table('servers', function (Blueprint $table) {
54-
$table->dropForeign('servers_node_id_foreign');
55-
$table->dropForeign('servers_owner_id_foreign');
56-
$table->dropForeign('servers_allocation_id_foreign');
57-
$table->dropForeign('servers_service_id_foreign');
58-
$table->dropForeign('servers_option_id_foreign');
59-
$table->dropForeign('servers_pack_id_foreign');
60-
61-
$table->dropIndex('servers_node_id_foreign');
62-
$table->dropIndex('servers_owner_id_foreign');
63-
$table->dropIndex('servers_allocation_id_foreign');
64-
$table->dropIndex('servers_service_id_foreign');
65-
$table->dropIndex('servers_option_id_foreign');
66-
$table->dropIndex('servers_pack_id_foreign');
57+
$table->dropForeign(['node_id']);
58+
$table->dropForeign(['owner_id']);
59+
$table->dropForeign(['allocation_id']);
60+
$table->dropForeign(['service_id']);
61+
$table->dropForeign(['option_id']);
6762

6863
$table->renameColumn('node_id', 'node');
6964
$table->renameColumn('owner_id', 'owner');
@@ -77,6 +72,7 @@ public function down()
7772
$table->foreign('allocation')->references('id')->on('allocations');
7873
$table->foreign('service')->references('id')->on('services');
7974
$table->foreign('option')->references('id')->on('service_options');
75+
$table->foreign('pack')->references('id')->on('service_packs');
8076
});
8177
}
8278
}

database/migrations/2017_03_10_162934_AddNewServiceOptionsColumns.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function up()
3434
public function down()
3535
{
3636
Schema::table('service_options', function (Blueprint $table) {
37-
$table->dropForeign('config_from');
37+
$table->dropForeign(['config_from']);
3838

3939
$table->dropColumn('config_from');
4040
$table->dropColumn('config_stop');

0 commit comments

Comments
 (0)