Harden PRAGMA table/foreign-key introspection + typed FK lookup for ER diagram #9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR improves how we introspect SQLite schema metadata by:
dbService.getForeignKeys(tableName)API (instead of parsing rawexecuteQueryresults).Changes
✅ ER diagram: use typed FK results
Replaced:
executeQuery(\PRAGMA foreign_key_list(${table.name}))+foreignKeys.values[...]indexingWith:
dbService.getForeignKeys(table.name)returning a typed arrayfk.column,fk.referencedTable,fk.referencedColumnDebug logging updated to match the new data shape and be more readable.
🔒 DatabaseService: quote identifiers in PRAGMA calls
Added
quoteIdentifier(identifier: string):"→"")Updated PRAGMA usages to quote
tableName:PRAGMA table_info(...)(both direct prepare + SQLCipher-safe executeQuery path)PRAGMA foreign_key_list(...)Why
fk[3],fk[2],fk[4]) and theexecuteQueryreturn shape.Solves this issue: #8
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.