Skip to content

Commit

Permalink
more fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Feb 23, 2024
1 parent b703aa7 commit 83292c3
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/Persistence/Sql/Sqlite/debug-attach/SqliteSchemaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public function listTableForeignKeys($table, $database = null)
{
$table = $this->normalizeName($table);

$columns = $this->selectForeignKeyColumns('', $table)
$columns = $this->selectForeignKeyColumns($database ?? 'main', $table)
->fetchAllAssociative();

if (count($columns) > 0) {
Expand Down Expand Up @@ -765,13 +765,15 @@ protected function selectIndexColumns(string $databaseName, ?string $tableName =

protected function selectForeignKeyColumns(string $databaseName, ?string $tableName = null): Result
{
$sql = <<<'SQL'
[$databaseName, $tableName] = self::extractSchemaAsPrefixFromTableName($tableName, $databaseName);

$sql = '
SELECT t.name AS table_name,
p.*
FROM sqlite_master t
JOIN pragma_foreign_key_list(t.name) p
FROM ' . $databaseName . 'sqlite_master t
JOIN ' . $databaseName . 'pragma_foreign_key_list(t.name) p
ON p."seq" != "-1"
SQL;
';

$conditions = [
"t.type = 'table'",
Expand Down

0 comments on commit 83292c3

Please sign in to comment.