Skip to content

Commit cd794c0

Browse files
Version Packages (next) (#38)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 300d024 commit cd794c0

3 files changed

Lines changed: 34 additions & 2 deletions

File tree

.changeset/pre.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"effect-v4-beta",
99
"insertable-null-and-jointable-fk",
1010
"jointable-db-interface-physical-columns",
11-
"legacy-customtype-detector"
11+
"legacy-customtype-detector",
12+
"uuid-detection-no-name-inference"
1213
]
1314
}

CHANGELOG.md

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

3+
## 6.0.0-next.4
4+
5+
### Minor Changes
6+
7+
- 300d024: fix: only treat `@db.Uuid` columns as UUIDs — drop field-name inference
8+
9+
`isUuidField` previously had a third detection tier that inferred UUID from the
10+
field _name_ (`/^id$/`, `/_id$/`, `/^.*_uuid$/`, `/^uuid$/`) for any `String`
11+
column. UUID is a column _type_, not a naming convention, so this was a
12+
false-positive generator: every external-system identifier stored as text — most
13+
notably Stripe IDs (`acct_…`, `cus_…`, `sub_…`, `price_…`, `txn_…`, `ch_…`,
14+
`evt_…`), plus slugs and provider/session references — ends in `_id` without
15+
being a UUID. The generator emitted `Schema.String.check(Schema.isUUID())` for
16+
those columns, and decoding real data threw `Die`/`ParseError`
17+
("Expected a UUID, got \"acct\_\"") at runtime.
18+
19+
Prisma always records a genuine `uuid` column via the `@db.Uuid` native type (a
20+
bare `String` maps to `text`), so the native-type and `@db.Uuid`-documentation
21+
checks already capture 100% of real UUID columns. The name-pattern tier only
22+
ever contradicted that authoritative information, so it has been removed.
23+
24+
`isUuidField` now returns true only when:
25+
1. `field.nativeType[0] === 'Uuid'` (a `@db.Uuid` column), or
26+
2. the field documentation includes `@db.Uuid`.
27+
28+
**Migration:** columns that are genuinely UUID-typed are unaffected (they carry
29+
`@db.Uuid`). Columns that were relying on name inference to get UUID validation
30+
lose it — which is the fix, since they were text. To keep an explicit UUID check
31+
on a non-`@db.Uuid` column, add `/// @db.Uuid` to the field, or override its
32+
schema with `/// @customType(...)`.
33+
334
## 6.0.0-next.3
435

536
### 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.3",
3+
"version": "6.0.0-next.4",
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)