TML-2790: M:N SQLite demo examples + project plan expansion (slices 4–6)#742
TML-2790: M:N SQLite demo examples + project plan expansion (slices 4–6)#742tensordreams wants to merge 14 commits into
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/extension-supabase
@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: |
16dc690 to
f3a7a5c
Compare
1e62c8e to
dbaf95a
Compare
f3a7a5c to
b772b54
Compare
e19ee4a to
074d298
Compare
b772b54 to
0f9d0c2
Compare
074d298 to
ce2608d
Compare
0f9d0c2 to
2a360f4
Compare
ce2608d to
ac1c05d
Compare
2a360f4 to
67fb93c
Compare
ac1c05d to
a5f259c
Compare
9feb292 to
facaadf
Compare
a5f259c to
9829a58
Compare
facaadf to
679770d
Compare
9829a58 to
79ebfd0
Compare
679770d to
302e804
Compare
20e4a68 to
7774dfc
Compare
302e804 to
100b1d5
Compare
7774dfc to
cef9592
Compare
100b1d5 to
91b8cc4
Compare
|
Reviewed this PR separately against |
tensordreams
left a comment
There was a problem hiding this comment.
Reviewed against projects/sql-orm-many-to-many/slices/04-sqlite-demo-examples/spec.md; ran pnpm -C examples/prisma-next-demo-sqlite typecheck and emit:check locally (both pass).
Solid, well-scoped PR: the new ORM-client modules are idiomatic and cleanly demonstrate the full M:N surface (include, some/none/every, connect/disconnect, nested create), castAs is used at branded-id boundaries with no bare as or any in the new files, the CLI wiring matches the existing command style exactly (usage errors, exit codes, JSON output), and the planning docs for slices 4–6 are internally consistent with correct ticket references. The upgrade note correctly lives only in the 0.13→0.14 cycle with no leftover in 0.12→0.13.
One issue should be resolved before merge: the newly committed migrations/app/refs/ snapshot is stale against the re-emitted contract (old canonical shape, mismatched storage hash) — see inline. Everything else is polish.
91b8cc4 to
4ea74ff
Compare
2f4d2d2 to
1d48265
Compare
2dc2eec to
f773b93
Compare
194bcbc to
f61b14e
Compare
f773b93 to
81eca2a
Compare
f61b14e to
2124c19
Compare
81eca2a to
3440e5d
Compare
2124c19 to
49c9d80
Compare
Adds Tag model, PostTag junction (composite PK post_tag_pkey), and rel.manyToMany() declarations on both Post.tags and Tag.posts. Re-emits contract.json / contract.d.ts; cardinality 'N:M' + through descriptor present in the generated artifacts. Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Adds five ORM client modules exercising the Post↔Tag N:M relation:
- get-post-tags: .include('tags', ...) — include read across junction
- get-posts-by-tag-filter: .some()/.none()/.every() on N:M relation
- connect-post-tags: update + t.connect([{id}]) callback mutator
- disconnect-post-tags: update + t.disconnect([{id}]) callback mutator
- create-post-with-tags: create + t.create([...]) nested mutation
Seed extended with Tag rows + junction rows (typescript/orm/demo tags
linked to First Post and Second Post). CLI commands registered in
main.ts. Migration refs committed for offline db:init reproducibility.
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Spec + plan amended for the follow-on scope (demos + authoring completeness): slice 4 SQLite demo examples (done, TML-2790), slice 5 PSL M:N authoring (TML-2794, framework gap — may promote to its own project), slice 6 PG demo examples + dual-mode reconciliation (TML-2795, blocked by slice 5). Slice specs + provisional dispatch plans for each. Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
…N examples The new main baseline (TML-2605) trips the no-bare-cast ratchet on the string->branded-id casts in the M:N example helpers (+10). Replace the bare `as PostId`/`as TagId` casts with castAs<T> to keep lint:casts at delta 0. Behaviour unchanged (casts are erased at runtime). Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
… models (TML-2807 rebase) The post_tag and tag models added by this branch were emitted before main emitted SqlModelStorage.namespaceId (TML-2807); re-emit so the demo contract matches a fresh emit. Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
…t<->Tag through The through descriptor now carries the junction's namespaceId; re-emit the demo contract so both M:N relations declare it. Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
…r upgrade instructions The check:upgrade-coverage gate requires every PR whose diff touches examples/ to also touch the in-flight user-skill instructions. The M:N demo additions need no user-side action (additive), so no new changes[] entry — the existing array stays; this records the incidental diff. Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
0.13.0 shipped without the M:N ORM-client examples, so the user-upgrade note belongs in a new 0.13→0.14 instructions directory, not the now-released 0.12→0.13 doc. The upgrade-coverage gate targets 0.13→0.14 after the release bump. Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Main renamed the char(36) uuid authoring helpers to make storage explicit (field.uuid -> field.uuidString, field.id.uuidv4 -> field.id.uuidv4String). The pre-existing User/Post models were migrated on main; the M:N models added on this branch still called the old names, failing contract emit. Emitted contract is unchanged (same storage semantics, no hash drift). Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Close the two coverage gaps against the shipped M:N runtime: a reverse-
direction include (tag-posts, db.Tag.include("posts")) and connect inside
the create flow (create-post-connect-tags). Document the M:N commands in
the README, including a prose note on the required-payload junction guard,
which has no runnable example by design (the type gate makes it
uncompilable). All 9 M:N commands smoke-tested end-to-end on a fresh
database.
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
3440e5d to
1f24648
Compare
bc92c1e to
868089d
Compare
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.