Skip to content

Commit

Permalink
Fix up stan errors
Browse files Browse the repository at this point in the history
While these foreign key toggles appear to work in tests. When testing
the same migration operations within an application the contraint error
is reproducible and not fixed still.
  • Loading branch information
markstory committed Sep 9, 2024
1 parent d316a20 commit d8ac1b0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Db/Adapter/SqliteAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -1046,13 +1046,14 @@ protected function copyAndDropTmpTable(AlterInstructions $instructions, string $
$state['selectColumns']
);

$foreignKeysEnabled = (bool)$this->fetchRow('PRAGMA foreign_keys')['foreign_keys'] ?? false;
$result = $this->fetchRow('PRAGMA foreign_keys');
$foreignKeysEnabled = $result ? (bool)$result['foreign_keys'] : false;
if ($foreignKeysEnabled) {
// $this->execute('PRAGMA foreign_keys = OFF');
$this->execute('PRAGMA foreign_keys = OFF');
}
$this->execute(sprintf('DROP TABLE %s', $this->quoteTableName($tableName)));
if ($foreignKeysEnabled) {
// $this->execute('PRAGMA foreign_keys = ON');
$this->execute('PRAGMA foreign_keys = ON');
}
$this->execute(sprintf(
'ALTER TABLE %s RENAME TO %s',
Expand Down

0 comments on commit d8ac1b0

Please sign in to comment.