Skip to content

Commit 5a85dcf

Browse files
Version Packages (next) (#36)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent ff58e31 commit 5a85dcf

3 files changed

Lines changed: 24 additions & 1 deletion

File tree

.changeset/pre.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"changesets": [
88
"effect-v4-beta",
99
"insertable-null-and-jointable-fk",
10+
"jointable-db-interface-physical-columns",
1011
"legacy-customtype-detector"
1112
]
1213
}

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
11
# Changelog
22

3+
## 6.0.0-next.3
4+
5+
### Patch Changes
6+
7+
- ff58e31: Fix: implicit M:N join tables now expose their physical `A`/`B` columns in the
8+
Kysely `DB` interface.
9+
10+
Kysely uses `DB`-interface field names as literal SQL column identifiers. The
11+
join-table entry was emitted as `Schema.Schema.Type<typeof JoinTable>`, whose
12+
keys are the **decoded** semantic names (`product_id`, `product_tag_id`). But an
13+
implicit many-to-many table's physical Postgres columns are `A`/`B` (Prisma's
14+
convention), so a query like
15+
`db.selectFrom('_product_tags').where('_product_tags.product_id', ...)` emitted
16+
`WHERE product_id` against a table that only has `A`/`B` → runtime SQL error.
17+
18+
The join-table `DB` entry is now `Schema.Codec.Encoded<typeof JoinTable>`, whose
19+
keys are the **encoded** physical columns `A`/`B` (carrying the branded
20+
`columnType` values, so joins remain type-safe against the parent table's branded
21+
id). The semantic-name mapping still lives only in the schema's
22+
`Schema.encodeKeys`, used when decoding a raw DB row. Regular (non-join) model
23+
tables are unchanged (`Schema.Schema.Type<typeof Model>`).
24+
325
## 6.0.0-next.2
426

527
### Patch Changes

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "prisma-effect-kysely",
3-
"version": "6.0.0-next.2",
3+
"version": "6.0.0-next.3",
44
"description": "Prisma generator that creates Effect Schema types from Prisma schema compatible with Kysely",
55
"license": "MIT",
66
"author": "Samuel Ho",

0 commit comments

Comments
 (0)