Merge pull request #601 from arcdigital/feature/PTDL-472-fix-migrations

Fix DB migrations to allow rollbacks
This commit is contained in:
Dane Everitt
2017-08-23 18:43:25 -05:00
committed by GitHub
2 changed files with 4 additions and 2 deletions

View File

@@ -23,8 +23,8 @@ class AllowNegativeValuesForOverallocation extends Migration
public function down() public function down()
{ {
Schema::table('nodes', function (Blueprint $table) { Schema::table('nodes', function (Blueprint $table) {
$table->mediumInteger('disk_overallocate')->unsigned()->nullable()->change(); DB::statement('ALTER TABLE nodes MODIFY disk_overallocate MEDIUMINT UNSIGNED NULL,
$table->mediumInteger('memory_overallocate')->unsigned()->nullable()->change(); MODIFY memory_overallocate MEDIUMINT UNSIGNED NULL');
}); });
} }
} }

View File

@@ -22,7 +22,9 @@ class SetAllocationUnqiueUsingMultipleFields extends Migration
public function down() public function down()
{ {
Schema::table('allocations', function (Blueprint $table) { Schema::table('allocations', function (Blueprint $table) {
$table->dropForeign(['node_id']);
$table->dropUnique(['node_id', 'ip', 'port']); $table->dropUnique(['node_id', 'ip', 'port']);
$table->foreign('node_id')->references('id')->on('nodes');
}); });
} }
} }