Skip to content

Commit

Permalink
DB: fix missing indexes
Browse files Browse the repository at this point in the history
  • Loading branch information
dasgarner committed Feb 27, 2024
1 parent 7c63958 commit 449c75e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions db/migrations/20240227102400_missing_indexes_migration.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ public function change(): void
{
$region = $this->table('region');
if (!$region->hasForeignKey('layoutId')) {
// Take care of orphaned regions
$this->execute('DELETE FROM `region` WHERE `layoutId` NOT IN (SELECT `layoutId` FROM `layout`)');

// Add the FK
$region
->addForeignKey('layoutId', 'layout', 'layoutId')
->save();
Expand Down

0 comments on commit 449c75e

Please sign in to comment.