From eeda06c4729a36b7a88c5a413978ec8626c867b0 Mon Sep 17 00:00:00 2001 From: polo Date: Tue, 20 Oct 2026 22:48:20 +0200 Subject: =?UTF-8?q?mise=20en=20place=20de=20l'h=C3=A9ritage=203,=20patch?= =?UTF-8?q?=20bug=20doctrine?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- patched fetchTableColumns.txt | 55 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 patched fetchTableColumns.txt diff --git a/patched fetchTableColumns.txt b/patched fetchTableColumns.txt new file mode 100644 index 0000000..d677034 --- /dev/null +++ b/patched fetchTableColumns.txt @@ -0,0 +1,55 @@ +getCreateTableSQL($tableName); + + if ($row['pk'] !== 0 && $row['pk'] !== '0') { + $pkColumnNamesByTable[$tableName][] = $row['name']; + } + } + + // ----- + $foreignKeyRows = $this->connection->fetchAllAssociative( + <<<'SQL' + SELECT t.name AS table_name, + p."from" AS column_name + FROM sqlite_master t + JOIN pragma_foreign_key_list(t.name) p + WHERE t.type = 'table' + SQL, + ); + + foreach ($foreignKeyRows as $foreignKeyRow) { + $foreignKeyColumnsByTable[$foreignKeyRow['table_name']] + [$foreignKeyRow['column_name']] = true; + } + // ----- + + foreach ($rows as $row) { + $tableName = $row['table_name']; + $columnName = $row['name']; + $tableSQL = $sqlByTable[$tableName]; + + $result[] = array_merge($row, [ + // ----- + 'autoincrement' => isset($pkColumnNamesByTable[$tableName]) + && $pkColumnNamesByTable[$tableName] === [$columnName] + && $row['type'] === 'INTEGER' + && ! isset($foreignKeyColumnsByTable[$tableName][$columnName]), + // ----- + 'collation' => $this->parseColumnCollationFromSQL($columnName, $tableSQL), + 'comment' => $this->parseColumnCommentFromSQL($columnName, $tableSQL), + ]); + } + + return $result; +} \ No newline at end of file -- cgit v1.2.3