Commit 7df8c26
committed
test(sql-orm-client): migration DDL + ORM include for implicit M:N
S4·M1 synthesises a model-less junction for an implicit many-to-many
(both navigable list ends bare, no junction model). This proves that
junction downstream: the migration system creates it, and the ORM
`include` walks it.
The `mn-psl-implicit` fixture authors `Post.tags Tag[]` / `Tag.posts
Post[]` with no junction model, emitted via the real pipeline for both
postgres and sqlite. The interpreter synthesises `_PostToTag` (composite
PK `(A, B)`, FK `A` → `posts.id`, FK `B` → `tags.id`) and lowers both
ends to `cardinality: 'N:M'` + `through` over it.
Migration DDL: the synthesised junction is a normal contract storage
table, so the migration planner creates it with no special-casing. A
migration test drives the real planner over each emitted contract against
an empty schema and asserts the `_PostToTag` `CREATE TABLE` (composite
primary key + the two foreign keys) is planned for postgres and sqlite.
Integration: an `include('tags')` test over the implicit M:N returns the
related rows (whole-row assertions, explicit + implicit select, PGlite),
walking the synthesised junction through a real emitted PSL contract with
no authored junction model.
Wires both emissions into the sql-orm-client emit script (so
`fixtures:check` regenerates them) and adds `@prisma-next/sqlite` to the
integration test package to emit the sqlite contract.
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>1 parent 88abbc3 commit 7df8c26
12 files changed
Lines changed: 1720 additions & 1 deletion
File tree
- packages/3-extensions/sql-orm-client
- test/integration
- test/sql-orm-client
- fixtures/mn-psl-implicit
- generated-sqlite
- generated
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| |||
Lines changed: 35 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
0 commit comments