mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-10-13 17:02:06 -05:00
Fix error when reverting changed migration.
When reverting changed migration, the down would fail because the foreign key constraint has to be dropped before you are able to rename the column.
This commit is contained in:
1 parent
43ac541cb8
commit
56490f0e84
1 file changed
+4
@@ -23,13 +23,17 @@ class ChangesForV322 extends Migration
|
||||
// rename fields
|
||||
Schema::table(
|
||||
'piggy_bank_events', function (Blueprint $table) {
|
||||
$table->dropForeign('piggy_bank_events_piggy_bank_id_foreign');
|
||||
$table->renameColumn('piggy_bank_id', 'piggybank_id');
|
||||
$table->foreign('piggybank_id')->references('id')->on('piggybanks')->onDelete('cascade');
|
||||
}
|
||||
);
|
||||
|
||||
Schema::table(
|
||||
'piggybank_repetitions', function (Blueprint $table) {
|
||||
$table->dropForeign('piggy_bank_repetitions_piggy_bank_id_foreign');
|
||||
$table->renameColumn('piggy_bank_id', 'piggybank_id');
|
||||
$table->foreign('piggybank_id')->references('id')->on('piggybanks')->onDelete('cascade');
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
Reference in new issue
Block a user