| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
chore(release): bump to 8.0.0-rc.12 (#30395) ## Release: 8.0.0-rc.11 → 8.0.0-rc.12 This is the release PR described in [docs/oss/versioning.md](https://github.com/prisma/orm/blob/main/docs/oss/versioning.md). It bumps every workspace package to 8.0.0-rc.12 and moves the Prisma dependencies to their latest versions. **Merging this PR ships the release.** The push to `main` carries the new root `version`. The `Publish to npm` workflow then publishes 8.0.0-rc.12 under `latest` and creates a pre-release GitHub Release from the notes file. ## Review these first - [docs/releases/v8.0.0-rc.12.md](https://github.com/prisma/orm/blob/release/8.0.0-rc.12/docs/releases/v8.0.0-rc.12.md): the release notes, which become the GitHub Release body. The same entry is at the top of `CHANGELOG.md`. - The upgrade guides for [apps](https://github.com/prisma/orm/blob/release/8.0.0-rc.12/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.11-to-8.0.0-rc.12/instructions.md) and [extensions](https://github.com/prisma/orm/blob/release/8.0.0-rc.12/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.11-to-8.0.0-rc.12/instructions.md). They merge the 24 pending fragments. The original fragments are moved unchanged to `upgrade-instructions/releases/8.0.0-rc.11-to-8.0.0-rc.12/sources/`. - Four guide entries have no fragment behind them. The `migration new` default and its removed error codes (#30389) had no guide entry. Neither did the PSL parser API changes (#30312, #30344, #30335, #30379). I wrote those entries while preparing the release. - Where fragments contradicted later code, the guide follows the code. Examples: the Supabase storage hash, `voidParamsSchema`, and quoted defaults printed by `infer`. ## Dependency updates | Package | From | To | Where | | --- | --- | --- | --- | | `@prisma/cli-engine` | 0.4.0 | 0.6.1 | examples, test fixtures, apps (the toolchain packages were already on 0.6.1 from #30372) | | `@prisma/dev` | 0.25.1 | 0.25.2 | the workspace catalog | | `@prisma/compute-sdk` | ^0.39.0 | ^0.43.0 | `apps/telemetry-backend` | | `@prisma/management-api-sdk` | ^1.56.0 | ^1.76.0 | `apps/telemetry-backend` | compute-sdk 0.43 renames "service" to "app" and "version" to "deployment". The telemetry deploy script now uses the new names. Both SDK versions call `/v1/apps/{appId}`, so the ID stored in the existing `TELEMETRY_DEPLOY_SERVICE_ID` secret is still correct. The app's typecheck now includes `scripts/`, so it catches the next SDK rename. The repo does not depend on `@prisma/composer`. ## Fixes needed to publish - **The publish workflow has failed on `main` since #30372.** `check:conformance` called the `orm` config validator as `validate(value)`. Engine 0.6 always calls `validate(value, provenance)`, and the validator reads `provenance.files`, so it threw on every input. The check now passes the same provenance the engine would. The prisma-cli copy of this check already does this. - `set-version` rewrote `workspace:@internal/cli@<version>` to `workspace:<version>`, dropping the alias. The prisma7-adoption example uses that alias. This is the first bump since the alias was added. - `lint:legacy-name` and the `add-model-map` test pointed at the pending fragment paths. They now point at the archived sources. ## Verification Passed locally: - `pnpm build` - `pnpm typecheck` - `pnpm lint` - `pnpm test:scripts` (563 tests) - `pnpm check:conformance` - `pnpm check:publish-deps` - `pnpm check:upgrade-coverage`, in both publish and PR mode - `pnpm check:release-notes`, in both publish and PR mode - `pnpm lint:legacy-name` - `pnpm lint:skills` - `pnpm test:packages`: all 18,196 tests passed Not covered locally, left to CI: - Three `test:packages` suites install packed tarballs from the registry. This machine's pnpm refuses `@vercel/detect-agent@1.2.5` because it has no provenance. CI passed the same suites on #30390. - `prisma-8-cloudflare-worker` needs a local Hyperdrive database. - The telemetry backend tests need Node 24.16 with `Temporal`. This machine has 24.13. - `fixtures:check` needs Postgres. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added PostgreSQL full-text search, multi-file schemas, prepared ORM reads and aggregates, and conflict-skipping options for bulk creation. * Added support for using a Prisma 7 schema as the contract source, JavaScript `Date` timestamps on PostgreSQL, editor support for attribute arguments, and per-finding diagnostics. * **Breaking Changes** * Prisma 8 schema files now require `// use prisma-8` on the first line; unmapped models use their names verbatim for table names. * Replace `dbgenerated(...)` with SQL tagged literals. Defaults must be valid for their column types, creation timestamps use the application clock, and native PostgreSQL enums no longer support text operations. * Config naming and path resolution, migration starting points, and extension contracts have changed. * **Bug Fixes** * Improved migration checks and branching warnings, contract generation and inference, default verification, and type checking. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> | 29 天前 | |
chore(release): bump to 8.0.0-rc.12 (#30395) ## Release: 8.0.0-rc.11 → 8.0.0-rc.12 This is the release PR described in [docs/oss/versioning.md](https://github.com/prisma/orm/blob/main/docs/oss/versioning.md). It bumps every workspace package to 8.0.0-rc.12 and moves the Prisma dependencies to their latest versions. **Merging this PR ships the release.** The push to `main` carries the new root `version`. The `Publish to npm` workflow then publishes 8.0.0-rc.12 under `latest` and creates a pre-release GitHub Release from the notes file. ## Review these first - [docs/releases/v8.0.0-rc.12.md](https://github.com/prisma/orm/blob/release/8.0.0-rc.12/docs/releases/v8.0.0-rc.12.md): the release notes, which become the GitHub Release body. The same entry is at the top of `CHANGELOG.md`. - The upgrade guides for [apps](https://github.com/prisma/orm/blob/release/8.0.0-rc.12/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.11-to-8.0.0-rc.12/instructions.md) and [extensions](https://github.com/prisma/orm/blob/release/8.0.0-rc.12/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.11-to-8.0.0-rc.12/instructions.md). They merge the 24 pending fragments. The original fragments are moved unchanged to `upgrade-instructions/releases/8.0.0-rc.11-to-8.0.0-rc.12/sources/`. - Four guide entries have no fragment behind them. The `migration new` default and its removed error codes (#30389) had no guide entry. Neither did the PSL parser API changes (#30312, #30344, #30335, #30379). I wrote those entries while preparing the release. - Where fragments contradicted later code, the guide follows the code. Examples: the Supabase storage hash, `voidParamsSchema`, and quoted defaults printed by `infer`. ## Dependency updates | Package | From | To | Where | | --- | --- | --- | --- | | `@prisma/cli-engine` | 0.4.0 | 0.6.1 | examples, test fixtures, apps (the toolchain packages were already on 0.6.1 from #30372) | | `@prisma/dev` | 0.25.1 | 0.25.2 | the workspace catalog | | `@prisma/compute-sdk` | ^0.39.0 | ^0.43.0 | `apps/telemetry-backend` | | `@prisma/management-api-sdk` | ^1.56.0 | ^1.76.0 | `apps/telemetry-backend` | compute-sdk 0.43 renames "service" to "app" and "version" to "deployment". The telemetry deploy script now uses the new names. Both SDK versions call `/v1/apps/{appId}`, so the ID stored in the existing `TELEMETRY_DEPLOY_SERVICE_ID` secret is still correct. The app's typecheck now includes `scripts/`, so it catches the next SDK rename. The repo does not depend on `@prisma/composer`. ## Fixes needed to publish - **The publish workflow has failed on `main` since #30372.** `check:conformance` called the `orm` config validator as `validate(value)`. Engine 0.6 always calls `validate(value, provenance)`, and the validator reads `provenance.files`, so it threw on every input. The check now passes the same provenance the engine would. The prisma-cli copy of this check already does this. - `set-version` rewrote `workspace:@internal/cli@<version>` to `workspace:<version>`, dropping the alias. The prisma7-adoption example uses that alias. This is the first bump since the alias was added. - `lint:legacy-name` and the `add-model-map` test pointed at the pending fragment paths. They now point at the archived sources. ## Verification Passed locally: - `pnpm build` - `pnpm typecheck` - `pnpm lint` - `pnpm test:scripts` (563 tests) - `pnpm check:conformance` - `pnpm check:publish-deps` - `pnpm check:upgrade-coverage`, in both publish and PR mode - `pnpm check:release-notes`, in both publish and PR mode - `pnpm lint:legacy-name` - `pnpm lint:skills` - `pnpm test:packages`: all 18,196 tests passed Not covered locally, left to CI: - Three `test:packages` suites install packed tarballs from the registry. This machine's pnpm refuses `@vercel/detect-agent@1.2.5` because it has no provenance. CI passed the same suites on #30390. - `prisma-8-cloudflare-worker` needs a local Hyperdrive database. - The telemetry backend tests need Node 24.16 with `Temporal`. This machine has 24.13. - `fixtures:check` needs Postgres. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added PostgreSQL full-text search, multi-file schemas, prepared ORM reads and aggregates, and conflict-skipping options for bulk creation. * Added support for using a Prisma 7 schema as the contract source, JavaScript `Date` timestamps on PostgreSQL, editor support for attribute arguments, and per-finding diagnostics. * **Breaking Changes** * Prisma 8 schema files now require `// use prisma-8` on the first line; unmapped models use their names verbatim for table names. * Replace `dbgenerated(...)` with SQL tagged literals. Defaults must be valid for their column types, creation timestamps use the application clock, and native PostgreSQL enums no longer support text operations. * Config naming and path resolution, migration starting points, and extension contracts have changed. * **Bug Fixes** * Improved migration checks and branching warnings, contract generation and inference, default verification, and type checking. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> | 29 天前 | |
TML-3531: Each default has one stored form, owned by its data type; dates, times and bytes are written with tags (#30750) A Postgres model with a date default, before and after this pull request: ```prisma // before model Invoice { id Int @id due Date @default("2024-01-31") total Numeric(10, 2) @default(1.5) } // after model Invoice { id Int @id due Date @default(date`2024-01-31`) total Numeric(10, 2) @default(1.5) } ``` Where the `due` and `total` defaults end up: | | Before | After | | --- | --- | --- | | `contract.json` | `"2024-01-31"`, `"1.5"` | `"2024-01-31"`, `"1.50"` | | `DEFAULT` clause | written by per-type code in the planner | written by the column's codec, as it writes a row | | `db verify` | normalises both sides' text, then compares | reads the database's default with the column's codec, then compares values | | `@default("2024-01-31")` | read as a string, then parsed by a cast from text | refused: ``Expected date`...`; write date`2024-01-31` `` | ## The decision A column's **data type** owns its values, and a **codec** only converts them. Every default is stored in one form, decided by the data type, and every tool reads and writes it through the same two pieces. This rewrites and implements ADR 254, "Data types and casts", for Postgres, SQLite, Mongo and the pgvector, PostGIS and arktype-json extensions. ## Two words this description uses - A **data type** is the database type of a column, as Prisma declares it: `pg/date`, `pg/numeric`, `sqlite/integer`, `pgvector/vector`. It knows the type's name in DDL and its parameters, such as `numeric(10,2)`. - A **codec** is how an application sees a column's values. One data type can have several: a `pg/timestamptz` column can be read as a `Date`, a `Temporal.Instant` or text, depending on the codec the schema picks. ## The problem Before this change the codec decided how a default was stored, and several places had their own code to make different spellings of one value equal. - Two codecs of one type could store the same value differently, so switching a column from `Date` to `Temporal` could change `contract.json`. - On SQLite a datetime default was `2024-01-01T00:00:00Z` in the contract and the `DEFAULT` clause, but every row the application wrote held `2024-01-01T00:00:00.000Z`. `db verify` and the planner each needed code to treat those as equal. - A date default was a quoted string, so a date column accepted any string until a cast from text tried to parse it, and `contract infer` could not tell a date from text when printing it back. ## How it works **The data type owns the value.** A value is `{ type, params, value }`, where `value` is the JSON `contract.json` stores. Only the data type builds one. Each data type declares how to read a value (it accepts every spelling it understands and refuses anything else) and how to spell it (the one form it stores): lower case for a uuid, two fraction digits on `numeric(10,2)` so `1.5` is stored as `"1.50"`, ISO 8601 text for dates and times. Loading a contract refuses a stored value in any other spelling. Because every codec's value goes through the data type, two codecs of one type can no longer store a value differently. **The codec converts.** A codec now has exactly four value methods. Two convert between the data type's value and the application's value (`fromDataTypeValue`, `toDataTypeValue`). Two convert between the application's value and what the database driver sends and receives (`fromWire`, `toWire`). The old `encode`, `decode`, `encodeJson` and `decodeJson` are gone, and every codec in the repository is converted. **Every tool goes through those two.** - *Loading a contract:* the CLI refuses a contract whose default its data type does not hold, and names the column. - *Writing a `DEFAULT` clause:* the planner hands the value to the column's codec and writes what the codec writes for a row. The SQLite datetime default and a row now hold the same text. - *Reading the database's default:* introspection takes the literal out of what the database reports and reads it with the column's codec, the same way it reads a row. - *Comparing:* `db verify` and the planner compare values, not text. The per-type normalising code (`toCanonicalForm` and the planners' copies of it) is deleted. - *Rows that come back as JSON*, in an `include` or an aggregate, are read with the same `fromWire` as an ordinary row. **Values with their own grammar are written with a tag.** A date, a time, an interval or bytes is written with its type's tag, `` date`2024-01-31` ``, and a quoted string on such a column is refused with the tag to write. Postgres gains `date`, `time`, `timetz`, `timestamp`, `timestamptz`, `interval` and `bytea`; SQLite gains `datetime` and `blob`. The language server offers only the tags a column takes. PostgreSQL's way of writing years before 1 AD and after 9999 is handled in one place. **SQLite's datetime and JSON columns get their own data types.** `sqlite/datetime` and `sqlite/json` are stored as SQLite `text`, so their DDL and `db verify` do not change, but their values are now typed. **`contract infer`, `contract print` and the Prisma 7 reader use the same values.** Infer reads a database default with the codec of the type it prints and writes it back with the type's tag. The Prisma 7 schema reader stores date, time and bytes defaults as values instead of SQL expressions, and refuses a `DateTime` default with more precision than its column rather than rounding it, naming what PostgreSQL would store. ## What users have to do Upgrade instructions ship in `upgrade-instructions/pending/data-type-values/`, for applications and for extension authors. - **SQLite projects:** a script rewrites stored contracts and migration snapshots to the new data types and stored values. Then rewrite quoted date, time, interval and bytes defaults as tags, run `contract emit`, then `db sign`. - **Postgres projects:** rewrite quoted date, time, interval and bytes defaults as tags. A contract emitted by an earlier release that stores a default in another spelling than its column gives (`"1.5"` on `numeric(10,2)`) is refused by the CLI until it is re-emitted and signed. - **Extension authors:** the four codec methods replace the old ones, and parameter limits move from the codec to the data type. Each change has a before-and-after sample. ## What changes in committed files - SQLite contracts and their `contract.d.ts` files are regenerated for `sqlite/datetime` and `sqlite/json`. SQLite DDL does not change. - The golden planner test records the DDL planned for every committed contract. Six of its Prisma 7 recordings change: date, time and bytes defaults the reader stored as SQL expressions are now typed literals, and `Decimal` defaults are written with the column's full scale. PostgreSQL stores the same values, which was checked against a database. No other DDL changes. ## How it was checked - Every codec is run against PGlite and SQLite, including the JSON form rows take in an `include`. - Two journeys migrate a default of every built-in type, with edge values, into PGlite and SQLite, verify with zero issues, then change one default by hand and check that verify names only that column. - Manual QA, recorded in `projects/data-types-completion/slices/3/manual-qa.md`: a SQLite project built with the previous release, upgraded by following the instructions; Postgres defaults on every date and time type, including years before 1 AD and after 9999, through migrate, verify, infer and print; and the Prisma 7 side-by-side flow with date defaults. - An in-loop review of each step and a separate four-part review of the whole branch; findings and rulings are in `projects/data-types-completion/slices/3/build-review.md`. ## Not in this pull request - `db verify` comparing a column's type through its data type, and the Prisma 7 reader printing the constructor each data type marks: TML-3387. - Function arguments, enum member values and discriminator values checked by the same rules as defaults: TML-3389. - Smaller items recorded in `projects/data-types-completion/deferred.md`, such as a SQLite datetime stored as seconds or a Julian day number, which still reads as milliseconds. ## Tickets Linear TML-3531, the third part of the "Data types own column types" project. It also closes TML-3394 (the Prisma 7 reader stored a date default as SQL), TML-3396 (PostgreSQL's year text), TML-3404 (SQLite wrote a datetime default in one fixed form) and TML-3405 (TypeScript defaults bypassed the data type), and it replaces TML-3406, whose code it deletes. The design was first proposed in prisma/orm#30656, closed so it is reviewed here next to the code. ## Alternatives considered - **Let the codec define the stored form.** The stored form would then depend on which codec a schema picked, and moving from `Date` to `Temporal` would change the contract. - **A separate normalising function per type that codecs and verification call.** It would be a second definition of a value beside the data type's reader. The data type's own spelling step does this job, so a value keeps one owner. - **Keep dates as quoted strings, read through a cast from text.** That cast would exist only to parse, and every date column would accept any string until the cast refused it. A tag says what the value is. - **Let the data type read the database's default text.** The data type would then parse SQL literals. The database's text is what the driver sends for a row, and the codec already reads that. - **Read JSON rows with the data type's reader.** Every query would have to produce the stored form in SQL, such as UTC text for every date. - **Declare SQLite datetime and JSON columns with their own SQLite types.** A column declared `JSON` makes SQLite convert a document like `"42"` to a number, and every existing table would need rebuilding. Agent: frigg-97 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> | 5 天前 | |
TML-3531: Each default has one stored form, owned by its data type; dates, times and bytes are written with tags (#30750) A Postgres model with a date default, before and after this pull request: ```prisma // before model Invoice { id Int @id due Date @default("2024-01-31") total Numeric(10, 2) @default(1.5) } // after model Invoice { id Int @id due Date @default(date`2024-01-31`) total Numeric(10, 2) @default(1.5) } ``` Where the `due` and `total` defaults end up: | | Before | After | | --- | --- | --- | | `contract.json` | `"2024-01-31"`, `"1.5"` | `"2024-01-31"`, `"1.50"` | | `DEFAULT` clause | written by per-type code in the planner | written by the column's codec, as it writes a row | | `db verify` | normalises both sides' text, then compares | reads the database's default with the column's codec, then compares values | | `@default("2024-01-31")` | read as a string, then parsed by a cast from text | refused: ``Expected date`...`; write date`2024-01-31` `` | ## The decision A column's **data type** owns its values, and a **codec** only converts them. Every default is stored in one form, decided by the data type, and every tool reads and writes it through the same two pieces. This rewrites and implements ADR 254, "Data types and casts", for Postgres, SQLite, Mongo and the pgvector, PostGIS and arktype-json extensions. ## Two words this description uses - A **data type** is the database type of a column, as Prisma declares it: `pg/date`, `pg/numeric`, `sqlite/integer`, `pgvector/vector`. It knows the type's name in DDL and its parameters, such as `numeric(10,2)`. - A **codec** is how an application sees a column's values. One data type can have several: a `pg/timestamptz` column can be read as a `Date`, a `Temporal.Instant` or text, depending on the codec the schema picks. ## The problem Before this change the codec decided how a default was stored, and several places had their own code to make different spellings of one value equal. - Two codecs of one type could store the same value differently, so switching a column from `Date` to `Temporal` could change `contract.json`. - On SQLite a datetime default was `2024-01-01T00:00:00Z` in the contract and the `DEFAULT` clause, but every row the application wrote held `2024-01-01T00:00:00.000Z`. `db verify` and the planner each needed code to treat those as equal. - A date default was a quoted string, so a date column accepted any string until a cast from text tried to parse it, and `contract infer` could not tell a date from text when printing it back. ## How it works **The data type owns the value.** A value is `{ type, params, value }`, where `value` is the JSON `contract.json` stores. Only the data type builds one. Each data type declares how to read a value (it accepts every spelling it understands and refuses anything else) and how to spell it (the one form it stores): lower case for a uuid, two fraction digits on `numeric(10,2)` so `1.5` is stored as `"1.50"`, ISO 8601 text for dates and times. Loading a contract refuses a stored value in any other spelling. Because every codec's value goes through the data type, two codecs of one type can no longer store a value differently. **The codec converts.** A codec now has exactly four value methods. Two convert between the data type's value and the application's value (`fromDataTypeValue`, `toDataTypeValue`). Two convert between the application's value and what the database driver sends and receives (`fromWire`, `toWire`). The old `encode`, `decode`, `encodeJson` and `decodeJson` are gone, and every codec in the repository is converted. **Every tool goes through those two.** - *Loading a contract:* the CLI refuses a contract whose default its data type does not hold, and names the column. - *Writing a `DEFAULT` clause:* the planner hands the value to the column's codec and writes what the codec writes for a row. The SQLite datetime default and a row now hold the same text. - *Reading the database's default:* introspection takes the literal out of what the database reports and reads it with the column's codec, the same way it reads a row. - *Comparing:* `db verify` and the planner compare values, not text. The per-type normalising code (`toCanonicalForm` and the planners' copies of it) is deleted. - *Rows that come back as JSON*, in an `include` or an aggregate, are read with the same `fromWire` as an ordinary row. **Values with their own grammar are written with a tag.** A date, a time, an interval or bytes is written with its type's tag, `` date`2024-01-31` ``, and a quoted string on such a column is refused with the tag to write. Postgres gains `date`, `time`, `timetz`, `timestamp`, `timestamptz`, `interval` and `bytea`; SQLite gains `datetime` and `blob`. The language server offers only the tags a column takes. PostgreSQL's way of writing years before 1 AD and after 9999 is handled in one place. **SQLite's datetime and JSON columns get their own data types.** `sqlite/datetime` and `sqlite/json` are stored as SQLite `text`, so their DDL and `db verify` do not change, but their values are now typed. **`contract infer`, `contract print` and the Prisma 7 reader use the same values.** Infer reads a database default with the codec of the type it prints and writes it back with the type's tag. The Prisma 7 schema reader stores date, time and bytes defaults as values instead of SQL expressions, and refuses a `DateTime` default with more precision than its column rather than rounding it, naming what PostgreSQL would store. ## What users have to do Upgrade instructions ship in `upgrade-instructions/pending/data-type-values/`, for applications and for extension authors. - **SQLite projects:** a script rewrites stored contracts and migration snapshots to the new data types and stored values. Then rewrite quoted date, time, interval and bytes defaults as tags, run `contract emit`, then `db sign`. - **Postgres projects:** rewrite quoted date, time, interval and bytes defaults as tags. A contract emitted by an earlier release that stores a default in another spelling than its column gives (`"1.5"` on `numeric(10,2)`) is refused by the CLI until it is re-emitted and signed. - **Extension authors:** the four codec methods replace the old ones, and parameter limits move from the codec to the data type. Each change has a before-and-after sample. ## What changes in committed files - SQLite contracts and their `contract.d.ts` files are regenerated for `sqlite/datetime` and `sqlite/json`. SQLite DDL does not change. - The golden planner test records the DDL planned for every committed contract. Six of its Prisma 7 recordings change: date, time and bytes defaults the reader stored as SQL expressions are now typed literals, and `Decimal` defaults are written with the column's full scale. PostgreSQL stores the same values, which was checked against a database. No other DDL changes. ## How it was checked - Every codec is run against PGlite and SQLite, including the JSON form rows take in an `include`. - Two journeys migrate a default of every built-in type, with edge values, into PGlite and SQLite, verify with zero issues, then change one default by hand and check that verify names only that column. - Manual QA, recorded in `projects/data-types-completion/slices/3/manual-qa.md`: a SQLite project built with the previous release, upgraded by following the instructions; Postgres defaults on every date and time type, including years before 1 AD and after 9999, through migrate, verify, infer and print; and the Prisma 7 side-by-side flow with date defaults. - An in-loop review of each step and a separate four-part review of the whole branch; findings and rulings are in `projects/data-types-completion/slices/3/build-review.md`. ## Not in this pull request - `db verify` comparing a column's type through its data type, and the Prisma 7 reader printing the constructor each data type marks: TML-3387. - Function arguments, enum member values and discriminator values checked by the same rules as defaults: TML-3389. - Smaller items recorded in `projects/data-types-completion/deferred.md`, such as a SQLite datetime stored as seconds or a Julian day number, which still reads as milliseconds. ## Tickets Linear TML-3531, the third part of the "Data types own column types" project. It also closes TML-3394 (the Prisma 7 reader stored a date default as SQL), TML-3396 (PostgreSQL's year text), TML-3404 (SQLite wrote a datetime default in one fixed form) and TML-3405 (TypeScript defaults bypassed the data type), and it replaces TML-3406, whose code it deletes. The design was first proposed in prisma/orm#30656, closed so it is reviewed here next to the code. ## Alternatives considered - **Let the codec define the stored form.** The stored form would then depend on which codec a schema picked, and moving from `Date` to `Temporal` would change the contract. - **A separate normalising function per type that codecs and verification call.** It would be a second definition of a value beside the data type's reader. The data type's own spelling step does this job, so a value keeps one owner. - **Keep dates as quoted strings, read through a cast from text.** That cast would exist only to parse, and every date column would accept any string until the cast refused it. A tag says what the value is. - **Let the data type read the database's default text.** The data type would then parse SQL literals. The database's text is what the driver sends for a row, and the codec already reads that. - **Read JSON rows with the data type's reader.** Every query would have to produce the stored form in SQL, such as UTC text for every date. - **Declare SQLite datetime and JSON columns with their own SQLite types.** A column declared `JSON` makes SQLite convert a document like `"42"` to a number, and every existing table would need rebuilding. Agent: frigg-97 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> | 5 天前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 29 天前 | ||
| 29 天前 | ||
| 5 天前 | ||
| 5 天前 |