Skip to content

docs: M:N ORM methods, composite PKs, expose_in_api, filter type-safety#69

Merged
pyramation merged 2 commits intomainfrom
devin/1774125055-orm-relations-composite-keys-docs
Mar 21, 2026
Merged

docs: M:N ORM methods, composite PKs, expose_in_api, filter type-safety#69
pyramation merged 2 commits intomainfrom
devin/1774125055-orm-relations-composite-keys-docs

Conversation

@pyramation
Copy link
Copy Markdown
Contributor

@pyramation pyramation commented Mar 21, 2026

Summary

Updates four skill reference files to document the v5 M:N ORM support implemented across PRs #863, #867, #869, #879, #880 in the main constructive repo.

Files changed:

  • codegen-relations.md — Major rewrite. Adds sections on: how M:N junction tables work, expose_in_api on relation_provision, add<Relation>()/remove<Relation>() generated methods, junction table CRUD, composite PK detection/naming/deletion, PK type safety, codegen pipeline architecture, filter type safety from schema, and a full M:N lifecycle walkthrough. Preserves existing "Posts with Comment Count", "User Feed with Mixed Content", and other pattern examples.
  • codegen-orm-output.md — Adds M:N convenience methods section (addTag/removeTag), junction table model entry, composite PK delete example.
  • query-meta-introspection.md — Adds junctionLeftKeyFields and junctionRightKeyFields to the example _meta query and response type comment.
  • SKILL.md — Updates the reference table entry for codegen-relations.md to reflect broader scope.

Updates since last revision

  • Restored the "Posts with Comment Count and Latest Comment" and "User Feed with Mixed Content" pattern examples that were previously removed from codegen-relations.md. These now coexist alongside the new M:N lifecycle example.

Review & Testing Checklist for Human

  • Verify code examples match actual ORM API — The addTag(postId, tagId), removeTag(postId, tagId), and composite PK delete({ where: { postId, tagId } }) signatures should be cross-referenced against the generated output from PR #880. These were written from context, not copied from generated code.
  • Verify expose_in_api description — Confirm the flag is on relation_provision, defaults to true, and syncs to smart_tags via triggers (as implemented in constructive-db PR #642).
  • Check _meta field names — Confirm junctionLeftKeyFields and junctionRightKeyFields are the actual field names exposed by the _meta endpoint (from enrich-relations.ts).

Notes

  • Tree-drawing characters in codegen-orm-output.md were changed from unicode (├── └──) to ASCII (|- '-). This is a minor formatting regression that may want correcting.
  • No test suite exists for this repo, so all correctness depends on human review against the actual constructive codebase.

Link to Devin session: https://app.devin.ai/sessions/745d2d10b699452091e24131ba5edef2
Requested by: @pyramation

@devin-ai-integration
Copy link
Copy Markdown

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@pyramation pyramation merged commit 31f0dba into main Mar 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant