Skip to content

Commit a73e71d

Browse files
committed
Fix DB migrations to allow rollbacks
1 parent 3ee5803 commit a73e71d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

database/migrations/2017_08_05_144104_AllowNegativeValuesForOverallocation.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ public function up()
2323
public function down()
2424
{
2525
Schema::table('nodes', function (Blueprint $table) {
26-
$table->mediumInteger('disk_overallocate')->unsigned()->nullable()->change();
27-
$table->mediumInteger('memory_overallocate')->unsigned()->nullable()->change();
26+
DB::statement('ALTER TABLE nodes MODIFY disk_overallocate MEDIUMINT UNSIGNED NULL,
27+
MODIFY memory_overallocate MEDIUMINT UNSIGNED NULL');
2828
});
2929
}
3030
}

database/migrations/2017_08_05_174811_SetAllocationUnqiueUsingMultipleFields.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ public function up()
2222
public function down()
2323
{
2424
Schema::table('allocations', function (Blueprint $table) {
25+
$table->dropForeign(['node_id']);
2526
$table->dropUnique(['node_id', 'ip', 'port']);
27+
$table->foreign('node_id')->references('id')->on('nodes');
2628
});
2729
}
2830
}

0 commit comments

Comments
 (0)