Skip to content

Commit

Permalink
Updated the way of the foreign keys dropping.
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslanbaidan committed Oct 9, 2024
1 parent 947ca02 commit 3a57413
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions migrations/db/20230901112005_fix_positions_cleanup_db.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ public function change()
->update();
/* Apply measures relation to soa. */
$soaTable = $this->table('soa');
$this->execute('ALTER TABLE `soa` DROP FOREIGN KEY `soa_ibfk_2`');
$soaTable->dropForeignKey(['measure_id', 'anr_id'])->update();
$soaTable->renameColumn('measure_id', 'measure_uuid')->update();
$soaTable->addColumn('measure_id', 'integer', ['signed' => false, 'after' => 'id'])->update();
Expand All @@ -234,7 +235,7 @@ public function change()
->update();
/* Apply measures relation to measures_amvs. */
$measuresAmvsTable = $this->table('measures_amvs');
$measuresAmvsTable->dropForeignKey(['measure_id', 'anr_id'])->update();
$this->execute('ALTER TABLE `measures_amvs` DROP FOREIGN KEY `measures_amvs_ibfk_3`');
$measuresAmvsTable
->removeColumn('anr_id2')
->removeColumn('creator')
Expand All @@ -261,7 +262,7 @@ public function change()
$measuresAmvsTable->removeColumn('measure_uuid')->update();
/* Apply measures relation to measures_rolf_risks. */
$measuresRolfRisksTable = $this->table('measures_rolf_risks');
$measuresRolfRisksTable->dropForeignKey(['measure_id', 'anr_id'])->update();
$this->execute('ALTER TABLE `measures_rolf_risks` DROP FOREIGN KEY `measures_rolf_risks_ibfk_3`');
$measuresRolfRisksTable
->removeColumn('creator')
->removeColumn('created_at')
Expand Down

0 comments on commit 3a57413

Please sign in to comment.