Repository navigation
TML-2790: M:N SQLite demo examples + project plan expansion (slices 4–6) - #697
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
size-limit report 📦
|
@prisma-next/extension-author-tools
@prisma-next/mongo-runtime
@prisma-next/family-mongo
@prisma-next/sql-runtime
@prisma-next/family-sql
@prisma-next/extension-arktype-json
@prisma-next/middleware-cache
@prisma-next/mongo
@prisma-next/extension-paradedb
@prisma-next/extension-pgvector
@prisma-next/extension-postgis
@prisma-next/postgres
@prisma-next/sql-orm-client
@prisma-next/sqlite
@prisma-next/target-mongo
@prisma-next/adapter-mongo
@prisma-next/driver-mongo
@prisma-next/contract
@prisma-next/utils
@prisma-next/config
@prisma-next/errors
@prisma-next/framework-components
@prisma-next/operations
@prisma-next/ts-render
@prisma-next/contract-authoring
@prisma-next/ids
@prisma-next/psl-parser
@prisma-next/psl-printer
@prisma-next/cli
@prisma-next/cli-telemetry
@prisma-next/emitter
@prisma-next/migration-tools
prisma-next
@prisma-next/vite-plugin-contract-emit
@prisma-next/mongo-codec
@prisma-next/mongo-contract
@prisma-next/mongo-value
@prisma-next/mongo-contract-psl
@prisma-next/mongo-contract-ts
@prisma-next/mongo-emitter
@prisma-next/mongo-schema-ir
@prisma-next/mongo-query-ast
@prisma-next/mongo-orm
@prisma-next/mongo-query-builder
@prisma-next/mongo-lowering
@prisma-next/mongo-wire
@prisma-next/sql-contract
@prisma-next/sql-errors
@prisma-next/sql-operations
@prisma-next/sql-schema-ir
@prisma-next/sql-contract-psl
@prisma-next/sql-contract-ts
@prisma-next/sql-contract-emitter
@prisma-next/sql-lane-query-builder
@prisma-next/sql-relational-core
@prisma-next/sql-builder
@prisma-next/target-postgres
@prisma-next/target-sqlite
@prisma-next/adapter-postgres
@prisma-next/adapter-sqlite
@prisma-next/driver-postgres
@prisma-next/driver-sqlite
commit: |
d711adf to
5ad3cff
Compare
3e1c908 to
308b48d
Compare
bd25a3c to
c1c88d2
Compare
308b48d to
bb3e246
Compare
c1c88d2 to
bd2c725
Compare
bb3e246 to
47cf59e
Compare
bd2c725 to
d39742d
Compare
47cf59e to
b04a59c
Compare
d39742d to
a0f11ba
Compare
b04a59c to
04522c0
Compare
a0f11ba to
f3ee50e
Compare
04522c0 to
4d8dad2
Compare
f3ee50e to
16dc690
Compare
4d8dad2 to
16dc690
Compare
|
Heads-up: this PR shows merged but nothing was actually merged — a botched force-push during a stack rebase briefly made the head identical to the base, and GitHub auto-marked it merged and deleted the branch. The branch is restored with identical content; review continues in #742. |
…–6) (prisma#742) > **Supersedes prisma#697** — that PR was auto-marked *merged* by GitHub when a botched force-push briefly made its head identical to its base (nothing was actually merged; the branch content is unchanged). Same commits, same review state. Follow-on to the [SQL ORM: Many-to-Many End to End](https://linear.app/prisma-company/project/sql-orm-many-to-many-end-to-end-c178df40ca3a) project: M:N **demo examples** + the project-plan expansion they surfaced. > **Stacked PR** — top of the M:N stack: `tml-2787` (prisma#683) → … → `tml-2729` (prisma#667) → `main` (the whole stack is rebased onto the latest `main`). ## SQLite demo M:N examples (`72ef8b793`, `883309ecc`) The SQLite demo (`examples/prisma-next-demo-sqlite`, TS-authored) now demonstrates the full M:N ORM API via a pure `Post ↔ Tag` junction (`PostTag`): - **Read:** `get-post-tags` — `.include(tags, t => t.select(...))`. - **Filter:** `get-posts-by-tag-filter` — `.where(p => p.tags.some/none/every(t => t.label.eq(...)))`. - **Write (callback mutator):** `connect-post-tags` / `disconnect-post-tags` / `create-post-with-tags` — `.update/.create({ tags: t => t.connect/disconnect/create([...]) })` with readback. Wired as 6 CLI commands + seed; **smoke-tested end-to-end** (SQLite is offline-runnable); emitted contract carries `cardinality:N:M` + `through`; `emit:check` + typecheck clean. ## Why only SQLite (and the plan expansion) (`d711adfb6`) Adding examples surfaced a real gap: **the navigable M:N API is authorable only via the TS contract builder (`rel.manyToMany`), not PSL** — PSL emits only `1:N`/`N:1` and routes M:N to explicit junction models. The PG demo emits from PSL, so it **cant** show M:N until PSL learns to author it. So: - **Filed [TML-2794](https://linear.app/prisma-company/issue/TML-2794)** — PSL many-to-many authoring (the framework gap). - **Filed [TML-2795](https://linear.app/prisma-company/issue/TML-2795)** — PG demo M:N examples + pre-existing dual-mode contract drift (blocked by TML-2794). - **Amended the project spec + plan** with follow-on **slices 4–6** (SQLite examples [done], PSL M:N authoring [planned], PG demo [planned]) + slice specs/plans. Slice 5 is framework-scoped and flagged for possible promotion to its own project. ## Scope / notes This PR ships the **SQLite** examples + the planning docs only. PG demo examples + PSL authoring are tracked (TML-2794/2795) and specd but not implemented here. No production `src/` changes — demo + project-docs only. Refs: TML-2790. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **New Features** * Expanded the sqlite demo to support `Post` ↔ `Tag` many-to-many tagging via a junction. * Added CLI commands to query posts/tags, apply tag filters (`some`/`none`/`every`), and connect/disconnect or create posts with tags. * **Documentation** * Updated the demo README to cover the full many-to-many API, command behaviors, and junction insert/delete notes. * Enhanced seeding instructions and the seed process to create tags and junction rows. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Alexey Orlenko's AI Agent <[email protected]>
Follow-on to the SQL ORM: Many-to-Many End to End project: M:N demo examples + the project-plan expansion they surfaced.
SQLite demo M:N examples (
72ef8b793,883309ecc)The SQLite demo (
examples/prisma-next-demo-sqlite, TS-authored) now demonstrates the full M:N ORM API via a purePost ↔ Tagjunction (PostTag):get-post-tags—.include(tags, t => t.select(...)).get-posts-by-tag-filter—.where(p => p.tags.some/none/every(t => t.label.eq(...))).connect-post-tags/disconnect-post-tags/create-post-with-tags—.update/.create({ tags: t => t.connect/disconnect/create([...]) })with readback.Wired as 6 CLI commands + seed; smoke-tested end-to-end (SQLite is offline-runnable); emitted contract carries
cardinality:N:M+through;emit:check+ typecheck clean.Why only SQLite (and the plan expansion) (
d711adfb6)Adding examples surfaced a real gap: the navigable M:N API is authorable only via the TS contract builder (
rel.manyToMany), not PSL — PSL emits only1:N/N:1and routes M:N to explicit junction models. The PG demo emits from PSL, so it cant show M:N until PSL learns to author it. So:Scope / notes
This PR ships the SQLite examples + the planning docs only. PG demo examples + PSL authoring are tracked (TML-2794/2795) and specd but not implemented here. No production
src/changes — demo + project-docs only.Refs: TML-2790.