cowork-bot: automated improvements (cowork/improve-json2sql-3) - #39
Open
github-actions[bot] wants to merge 2 commits into
Open
cowork-bot: automated improvements (cowork/improve-json2sql-3)#39github-actions[bot] wants to merge 2 commits into
github-actions[bot] wants to merge 2 commits into
Conversation
…s carry arrays Grouping children per key so convert()/generate_schema() emit exactly one CREATE TABLE per child table, with every child row linked to its own parent FK (previously duplicate CREATE TABLEs and dropped rows).
When flattening nested arrays, the FK column in the child table must match
the parent table's primary key column name and type. Previously the code
preferred 'name' over explicit ID fields like 'user_id' or 'users_id',
causing a type mismatch (TEXT FK vs INTEGER PK).
New priority order for parent reference key:
1. 'id' (generic primary key)
2. '{parent_table}_id' (table-specific, e.g., 'users_id')
3. Any key ending in '_id' found in parent objects (e.g., 'user_id')
4. 'name' (fallback only when no ID-like field exists)
Added 12 regression tests covering all three dialects (Postgres, MySQL, SQLite).
Contributor
Author
🤖 Automated Code Review✅ Ruff Lint — No issues
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Automated improvement PR from the Cowork repo-improver rotation (one coherent senior-dev improvement per run; see individual commit messages). Subsequent runs push additional commits to this PR rather than opening new ones.