TML-2795: M:N slice 6 — PG demo M:N examples + PSL-only contract source#820
TML-2795: M:N slice 6 — PG demo M:N examples + PSL-only contract source#820tensordreams wants to merge 8 commits into
Conversation
The no-emit CLI, its queries, and the TS-leg test files all consume the TypeScript contract source, which is being dropped in favour of the canonical PSL source (the demo becomes PSL-only). The emit-side suite already covers the enum type surface (test/demo-dx.types.test.ts); the runtime enum-surface integration coverage leaves with the TS leg. Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
…urce The TS-builder contract had drifted from the canonical PSL source (no discriminated Task/Bug/Feature hierarchy, no displayName, untyped address), keeping the dual-mode emit comparison permanently red on the TS leg. The demo now emits exclusively from src/prisma/contract.prisma: the TS emit config, the emit:ts/emit:psl/test:dual-mode scripts, and the @prisma-next/sql-contract-ts dependency are removed. The pnpm-lock.yaml @vitest/coverage-v8 peer-suffix churn is mechanical pnpm install re-resolution output. 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>
Adds a Tag model and a PostTag explicit-junction model (composite @@id over the two FK columns, two @relation N:1s) plus bare list fields on both sides, so the PSL interpreter lowers the pair to navigable N:M relations with a populated through descriptor. Re-emits the contract artifacts and extends the app migration chain with the planned tag/post_tag delta (tables, FK indexes, foreign keys). Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Mirrors the SQLite demo M:N surfaces in the PG demo conventions: include in both directions (repo-post-tags, repo-tag-posts), some/none/every relation filters (repo-posts-with-tag-*), and nested connect/disconnect/create writes through the callback mutator (repo-connect-post-tags, repo-disconnect-post-tags, repo-create-post-with-tags, repo-create-post-connect-tags). The seed gains three tags and junction rows (third post stays untagged so the every filter is observable), and the README documents the commands plus the required-payload junction guard. Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
One focused file in the demo test pattern (withDevDatabase + initTestDatabase): whole-row include readback after connect, disconnect, and both create flows; explicit selects in most reads plus one implicit default-selection include; and some/none/every filter coverage including the vacuous-truth every case on an untagged post. Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
|
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 |
@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: |
size-limit report 📦
|
Slice 6 (final) of the SQL ORM: Many-to-Many End to End project. Refs TML-2795.
Overview
Two halves, per the slice spec:
A. Dual-mode reconciliation → PSL-only. The PG demo was nominally dual-mode (PSL + TS contract sources expected to emit identically), but the TS leg had drifted — the TS builder cannot author the discriminated
Task/Bug/Featurehierarchy, sotest:dual-modewas red. This PR resolves it via the spec's option (ii): the TS contract source is removed and PSL becomes the single source. That removal necessarily took the no-emit workflow with it (it exists only to showcase the TS-authored contract) — decision and coverage notes recorded in the project's unattended-decisions log. After slice 5, PSL is strictly the more capable authoring surface for this demo: it authors both the discriminator hierarchy and M:N, neither of which the TS builder can express.B. M:N examples.
Post ↔ TagM:N authored in PSL using slice 5's explicit-junction form (composite-@@idPostTag+ bare lists both sides), with a properly chained 6-op migration (20260612T1945_add_post_tags— tag + junction tables, composite PK, FK indexes/FKs; not a re-baseline). All nine M:N surfaces from the SQLite demo are mirrored asrepo-*CLI commands: include both directions,some/none/everyfilters (vacuous-trutheveryobservable via an untagged seed post), connect, disconnect, nested create, and connect-in-create. Seed adds tags + junction rows; README documents the commands and the required-payload-guard behavior.Tests
8 PGlite-backed integration tests (
test/many-to-many.integration.test.ts) per the project standard: whole-shapetoEqual, explicitselectin most reads plus one implicit default-selection include, all three filter predicates, and include-readback after each of the four write kinds. Full demo suite: 9 files / 59 tests. Rootfixtures:checkandtypecheck:examplesgreen.Scope
examples/prisma-next-demoonly — no framework, PSL-interpreter, or sql-orm-client changes (slice 5 needed no fixes to support this). With this slice, the M:N API is demonstrated in both demos and the project's follow-on scope is complete.