Fixes migrations to actually rollback all the way.
This commit is contained in:
parent
33262cf34c
commit
d695532aa2
10 changed files with 20 additions and 34 deletions
|
@ -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');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue