Skip to content

Commit 83292c3

Browse files
committed
more fix
1 parent b703aa7 commit 83292c3

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

src/Persistence/Sql/Sqlite/debug-attach/SqliteSchemaManager.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ public function listTableForeignKeys($table, $database = null)
204204
{
205205
$table = $this->normalizeName($table);
206206

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

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

766766
protected function selectForeignKeyColumns(string $databaseName, ?string $tableName = null): Result
767767
{
768-
$sql = <<<'SQL'
768+
[$databaseName, $tableName] = self::extractSchemaAsPrefixFromTableName($tableName, $databaseName);
769+
770+
$sql = '
769771
SELECT t.name AS table_name,
770772
p.*
771-
FROM sqlite_master t
772-
JOIN pragma_foreign_key_list(t.name) p
773+
FROM ' . $databaseName . 'sqlite_master t
774+
JOIN ' . $databaseName . 'pragma_foreign_key_list(t.name) p
773775
ON p."seq" != "-1"
774-
SQL;
776+
';
775777

776778
$conditions = [
777779
"t.type = 'table'",

0 commit comments

Comments
 (0)