GeezerVison is showing github.com — TML-3712: PostgreSQL gets convenience types DateTime, Date, Time and Duration, and the tools write them by wmadden-electric · Pull Request #30847 · prisma/orm
Conversation
Linked issue
Fixes TML-3712 and TML-3713. Part of the Convenience date and time types project (TML-3709). The tools work was reviewed as #30858 and squash-merged into this branch so both reach main in one merge-queue entry.
Summary
model Order {
id Int @id
paidAt DateTime // TimestamptzJsDate(3): timestamptz(3), a JavaScript Date
settledAt DateTime(as: temporal) // TimestamptzTemporal: timestamptz, a Temporal.Instant
legacyAt DateTime(storage: timestamp) // TimestampJsDate(3): timestamp(3), a Date stored as UTC
shipBy Date // DateString: date, "2024-02-29"
opensAt Time(precision: 0) // TimeString(0): time(0), "09:30:00"
period Duration // IntervalString: interval, "P1M"
updatedAt DateTime @onCreate(now()) @onUpdate(now()) // the now() generator for TimestamptzJsDate
}
The decision: PSL and the TypeScript builder get four convenience types for PostgreSQL, DateTime, Date, Time and Duration, and the tools that write a schema for you write them. Each type is named for what a field means and becomes exactly one explicit type, such as TimestamptzJsDate(3). The contract stores only that explicit type: paidAt DateTime emits exactly the column paidAt TimestamptzJsDate(3) emits. No default needs a Temporal polyfill. ADR 279, on main since #30834, is the design.
Why
Prisma 8's explicit types make every choice visible: TimestamptzJsDate is a timestamptz column read as a Date. But each name fixes both the column type and the kind of value, so there are many names and no obvious one to start with. Prisma 8 gives explicit controls first and builds convenience on top of them, as the client facades do for the runtime. These types are that convenience layer for dates and times, and they only help if the schemas users start from, the ones contract infer, the Prisma 7 reader and prisma orm init write, use them.
A convenience type is a type choice
A type choice is a new kind of type declaration. It declares:
- option arguments, each with a fixed set of values written as bare names, and a default:
as: (the value the application reads: jsDate, temporal, string, parts) and storage: (the database type);
- arguments it hands on to the chosen type, such as
precision:;
- a table from each allowed combination of option values to an explicit type, with any argument defaults for that row.
// @internal/target-postgres: type-constructors.ts
DateTime: { kind: 'typeChoice', args: [/* as, storage, precision */], choices: [
{ when: { as: 'jsDate', storage: 'timestamptz' }, type: 'TimestamptzJsDate', defaults: { precision: 3 } },
{ when: { as: 'temporal', storage: 'timestamptz' }, type: 'TimestamptzTemporal' },
// …
] }
A call fills in the default options, looks up the row, and builds the explicit type it names, so bare DateTime is its default row. A call is refused at the argument that makes it invalid, and the message lists what that argument accepts:
- a value an option does not list, such as
Date(as: jsDate);
- a combination with no row:
Argument "storage" of Time cannot be timetz with as: temporal; write one of: time.;
- an argument the chosen type does not take, such as
Date(precision: 3).
When a target's types are loaded, a type choice is refused if it names an explicit type the target does not declare, has two rows for one combination, lists a value or default its option does not declare, or gives a row default for an argument the chosen type does not take.
Every place that needs a field's codec resolves the call first, including inside a types {} alias: the PSL interpreter, the @default value check, the @onCreate/@onUpdate generator lookup, the Prisma 7 reader, the MongoDB interpreter (which shares the resolution) and the language server. So DateTime(as: temporal) @onCreate(now()) gets the generator for TimestamptzTemporal.
TypeScript: one object per call
type.DateTime(...), type.Date(...), type.Time(...) and type.Duration(...) take their arguments as one object: type.DateTime({ as: 'string', precision: 6 }). Each has one overload per row, so a call is typed as the explicit type it becomes. An unknown key, a combination with no row, an argument the chosen type does not take, and a positional call all fail to compile. Explicit constructors stay positional: type.TimestamptzJsDate(3).
DateTime, Date and Time change meaning
These three names read Temporal values before; that meaning is now TimestamptzTemporal, DateTemporal and TimeTemporal. Every Prisma 8 PostgreSQL schema in the repository that used the old meaning is rewritten to the explicit names, so no committed contract.json changes from the rename. The upgrade instruction gives users the same rewrite.
The tools write the convenience types
contract infer on this table:
CREATE TABLE event (at timestamptz, paid_at timestamptz(3), legacy timestamp(3),
day date, opens time(0), local_at timetz, span interval);
writes:
model Event {
at DateTime(precision: 6) // TimestamptzJsDate(6)
paidAt DateTime // TimestamptzJsDate(3)
legacy DateTime(storage: timestamp) // TimestampJsDate(3)
day Date // DateString
opens Time(precision: 0) // TimeString(0)
localAt Time(storage: timetz) // Timetz
span Duration // IntervalString
}
That schema emits, db verify finds nothing, and the planner plans nothing.
- Infer takes the default path, unless that type cannot read the column's own default. A
timestamp(3) DEFAULT 'infinity' column becomes DateTime(as: string, storage: timestamp, precision: 3), because a Date cannot hold infinity and every row created with that default would fail to read. Otherwise, for each column it picks the explicit type the convenience default gives, then writes the shortest convenience call that becomes it, with arguments always by name. It writes the explicit type only when no convenience call fits, such as a timestamp read as Temporal.PlainDateTime (TimestampTemporal). contract print writes the same forms. One framework helper builds the call for both, and re-resolves it to prove it gives the same codec and parameters.
- An omitted precision compares equal to 6 on the date and time data types, because PostgreSQL stores microseconds either way. That lets infer write
DateTime(precision: 6) for a bare timestamptz and still verify clean. The planner's check after ADD COLUMN still compares the type as written (catalogParams). No stored contract or hash changes from this.
- The Prisma 7 reader maps Prisma 7's
DateTime to TimestampJsDate(3), printed DateTime(storage: timestamp), and @db.Timestamptz(p), @db.Date, @db.Time(p), @db.Timetz(p) to the matching convenience forms. An adopted project reads Date values where it read strings.
temporal.CreatedAt and temporal.UpdatedAt are built on TimestamptzJsDate(3), exactly bare DateTime; their String and JsDate variants are removed.
prisma orm init writes createdAt DateTime @default(now()) @onCreate(now()) and updatedAt temporal.UpdatedAt, in PSL and TypeScript.
Two fixes the default path needs
A Date cannot hold digits below a millisecond. ADR 254 says a codec refuses a stored value its application value cannot hold exactly; the Date codecs dropped the extra digits instead. The PostgreSQL timestamptz and timestamp Date codecs and MySQL's datetime Date codec now refuse such a value in fromDataTypeValue, so a .123456 default on a DateTime field is refused at authoring. Rows still read with the digits dropped. Infer prints a microsecond default as its raw SQL expression, and the Prisma 7 reader writes one through its target binding (refusedLiteralDefault). db verify cannot see a difference below a millisecond on a Date column; the docs say so.
now() rounds down to the column's precision. On a timestamp(0) column, now() at 23:59:59.700 generated a value PostgreSQL rounds up, so the row stored a time later than the write, on the next day at midnight. The PostgreSQL now generators for every timestamp codec (Date, Temporal and string) now take the column's precision and round down, as the time generators already did. Contracts with these generators get a new execution hash; the storage hash does not change.
Smaller changes
- The missing-Temporal error (
RUNTIME.TEMPORAL_UNAVAILABLE) points to the convenience defaults, and the error reference lists every Temporal codec.
- Hover on a convenience call names the explicit type that call is (
DateTime(as: temporal) is exactly TimestamptzTemporal), shows each argument's values, and lists which explicit type each combination becomes.
- The glossary defines "explicit type", "convenience type" and "type choice"; ADR 254, 257 and 275 carry notes pointing to ADR 279.
Testing performed
pnpm build, pnpm typecheck, pnpm fixtures:check, pnpm lint:deps, pnpm lint:ratchets, pnpm lint:docs, pnpm check:error-reference, pnpm check:upgrade-coverage --mode pr.
- Package tests with coverage and lint: framework-components, psl-parser, contract-psl, contract-ts, family-sql, contract-prisma7, MongoDB contract-psl, language-server, target-postgres, adapter-postgres, driver-postgres, target-mysql, CLI and the postgres facade.
- Type tests for every row of each table, and negative type tests for each refused call shape.
- Integration, run locally because PR CI skips it: every integration file about defaults, generators, dates or times,
test/sql-orm-client, psl-print, psl-infer, contract-parity, prisma7-source, and the infer, Prisma 7, init and convenience-types journeys. A journey reads every convenience default from PostgreSQL in a process with no global Temporal. A PGlite test checks that now() at precision 0, 1 and 2 stores the value the client holds.
contract infer on the table above writes that schema, which emits, verifies clean and plans nothing. examples/prisma7-adoption tests.
Skill update
skills/prisma-8/references/ (contract, debug, errors, quickstart) describe both layers and what infer writes. Upgrade instructions: convenience-date-time-types (the PSL and TypeScript rewrites for the names that change meaning) and tools-write-convenience-types (re-emit and db sign adopted projects and read Date where strings were read; rewrite the removed alias variants; write a sub-millisecond default on a Date field another way; re-emit for the now() precision). Each has a detection test.
Checklist
- All commits are signed off.
- Scoped to one logical concern: the convenience date and time types, and the tools writing them.
- Tests are updated.
- The PR title is in
TML-NNNN: <sentence-case title> form.
- The Skill update section is filled in.
Notes for the reviewer
- Since the last review, the options are
as: and storage: (they were value: and column:), and the TypeScript helpers take one object (they were positional). "Value" already means a data type's stored value in ADR 254, and column is a SQL word where a convenience name must mean the same on every target.
- TML-3713: contract infer, contract print, the Prisma 7 reader and orm init write the convenience date and time types #30858 was approved before it was folded in; after that approval it gained the rename, the
now() precision fix, the missing-Temporal error text and the upgrade table's ISO wording.
- Merging main's removal of field presets: the refusal for a removed date or time preset names the convenience call that stores what the preset stored, such as
DateTime(as: temporal) @onCreate(now()), with a ? or [] right after the type. The option argument kind remains only for type choices.
- Ten Prisma 7 fixtures changed codec and hash;
examples/prisma7-adoption reads a Date.
- SQLite, MySQL and MongoDB convenience types are TML-3714; other scalars are TML-3715.
Alternatives considered:
- A select template over option arguments (the field-preset machinery). It has no defaults and no way to refuse a combination.
- One codec parameterized by column type. A codec represents exactly one data type (ADR 254).
- Keep the Temporal meanings and give the convenience types new names. Then
DateTime, the name every Prisma 7 user writes first, would be the one that needs a polyfill.
- Options named
value:/column: or jsType:/dbType:. See the first reviewer note; jsType: and dbType: read as jargon.
- Infer writes the string types for microsecond columns, which lose nothing. The schema would differ from what a user would write.
- Store an omitted precision as 6 in the contract. It would change existing contracts and hashes; comparing in normal form changes none.
Agent: sauron-95
🤖 Generated with Claude Code
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…ADR 279
PostgreSQL date and time types get two layers: the explicit, database-named
types stay, and DateTime, Date, Time and Duration become convenience types
whose value: and column: arguments choose one explicit type, with defaults
that need no Temporal. Adds the project spec, plan and design notes, the
draft ADR, its index row, and a note in the rename project that it now
keeps DateTime.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…ir ids, DateStyle=ISO is a connection requirement, no deprecated aliases before RC, Temporal types from temporal-spec, and the Prisma 7 now() fix as slice 2
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
The PostgreSQL target's Temporal codecs and now generators named Temporal
through an undeclared global, so a project without the polyfill's global
type declarations saw every Temporal field as any. They now import the
types from temporal-spec, a types-only dependency at the version
temporal-polyfill 1.0.x uses. No runtime entry imports anything new.
A type test in the postgres extension, compiled without any global Temporal
declaration, checks a Temporal field is precisely typed, and the target's
src is type-checked without the global declarations.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…put type
Every PostgreSQL type for a column with several codecs now carries a suffix
naming its kind of value. Timestamptz becomes TimestamptzTemporal, Timestamp
becomes TimestampTemporal and Interval becomes IntervalParts, with no
deprecated aliases: the old names are errors. DateTemporal and TimeTemporal
are added beside Date and Time, which keep their meaning for now.
IntervalParts keeps the inferred mark Interval had, so contract infer writes
it for an interval column.
An interval column with a precision was typed as a branded string although
its codec reads { months, days, micros }; it now has the codec's type. The
adapter's intervalColumn helper becomes intervalPartsColumn.
Every PSL file, PSL string in tests, doc and skill reference moves to the
new names. The Supabase contract source changes only its type names.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Three PostgreSQL codecs complete the explicit date and time types:
- pg/timestamp-date@1 (TimestampJsDate): a timestamp column read and
written as a JavaScript Date, treating the stored date and time as UTC.
- pg/timestamp-instant@1 (TimestampInstant): the same column read and
written as a Temporal.Instant in UTC.
- pg/interval-string@1 (IntervalString): an interval read and written as
the ISO 8601 duration pg/interval stores, whatever IntervalStyle the
server prints in.
Both timestamp codecs refuse infinity and a value past the last instant a
Date or Temporal.Instant holds, naming TimestampString, and use now()
through timestampNow and instantNow. The interval codec validates the
duration on write and keeps the form a value was written in. Each codec
has its aggregate rows, conformance cases against PostgreSQL, and a test
that reads values the runtime driver returns under another session time
zone.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
… string types
timestampJsDateColumn, timestampInstantColumn and intervalStringColumn(precision?)
give a TypeScript contract the new explicit PostgreSQL types.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
contract print writes TimestampJsDate, TimestampInstant, IntervalParts and
IntervalString as written, and DateTemporal and TimeTemporal as Date and
Time, which mean the same for now.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Every emitted PostgreSQL contract.d.ts lists the aggregates of each codec in
the stack, so the three new codecs add min and max rows, and sum and avg rows
for the interval string codec, to each one. contract.json does not change.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
The app and extension guides give the rename table for Timestamptz,
Timestamp and Interval, the renamed TypeScript helpers, the interval
output type, and the Temporal types now taken from temporal-spec.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
The scalar types reference lists the three new explicit types and how they
read and write, and the codec authoring guide, the target README and the
prisma-8 skill references name them.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
The postgres extension's declarations name temporal-spec types, so it and
the published @prisma/orm-postgres that bundles it declare temporal-spec
as a dependency. check:publish-deps refused the package before.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
No column was typed by them. Every contract.d.ts that still imported them,
or the removed Interval, drops those import names: two hand-kept fixtures
and the migration snapshots under examples and the telemetry backend. The
upgrade instructions tell consumers to do the same, with a detection that
also matches an inline type import.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
PostgreSQL fills a timestamp column's now() default in the session's time
zone, so under a TimeZone other than UTC it reads back shifted through
TimestampJsDate and TimestampInstant, while @onCreate(now()) writes UTC from
the client. The docs claimed neither depended on the time zone. A test
under an Asia/Kolkata session pins both behaviours. The lowering is
unchanged.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
The codecs read and write the same text under TZ=UTC, Asia/Kolkata and
America/Los_Angeles, so a read or write that used the host's local time
fails. TimestampInstant's refusal of a stored value past the last instant
is tested too.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
contract infer writes TimestampString for a timestamp column, so the
generator's CreatedAt alias is keyed by that name.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Covers the PSL and TypeScript renames, both forms of a type import of a
removed branded type, and the whole-file temporal-spec pattern.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
The single-import-root lint reads import-shaped text in a test as an import,
so the sample imports build the published name at run time.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
The target now lists TimestamptzTemporal, DateTemporal and TimeTemporal
before their second names DateTime, Date and Time, so contract print writes
the explicit names. The second names will become convenience types with
other defaults, and a schema print wrote with them would then change codec.
contract infer is unchanged: it writes the constructor marked inferred.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
- The adapter README names the time column helpers that exist.
- The extension upgrade instructions also cover the temporal-spec types and
the new aggregate rows in an emitted contract.d.ts, and their detection
is tested.
- The scalar types reference says a Date drops digits past milliseconds,
so an equality filter with a value read back can miss a row, and names
TimestampInstant and TimestampString to keep them.
- withoutUtcDesignator is no longer exported.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…ing alternatives
When the default-path type cannot read a column default, infer walks the
type choice's rows. It now looks each row's constructor up in the
authoring namespace and compares its codec's data type with the marked
constructor's, so InferredTypeConstructor no longer carries the list of
every other constructor of its data type. Behaviour is unchanged.
The infer test fixture's dataTypeOfCodec now answers from the codec
lookup, as the assembled stack does.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Hover printed the explicit type a convenience call becomes with its own
printer: the bare constructor name, without the type choice's namespace,
and each argument through JSON.stringify, which quotes strings unlike
PSL and throws on a bigint, so the whole hover disappeared.
The literal writer that infer and print use moves from the SQL family
to framework-components, so hover can use it: writeDataTypeValue,
writtenTypeArguments, and writeTypedLiteral (formerly
writeDefaultLiteral, now taking the receiving data type rather than a
column codec, so the framework stays family-blind). A new
writtenTypeConstructorCall writes a call with its arguments by name. Hover now writes the full path, such as
pg.Stamp(precision: 3), in both the "is exactly" line and the table of
choices, and names no explicit type when an argument has no literal.
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…eset's type
ADR 279 says the tools write the convenience call wherever one gives a
column's explicit type. The refusals for removed date and time presets
named the explicit type instead: dateTime() said to write
TimestamptzTemporal, which contract print then rewrites as
DateTime(as: temporal).
Each date and time row now writes the convenience call where one is
exact: DateTime(as: temporal) for dateTime(), temporal.createdAt() and
temporal.timestamptz(); DateTime(as: string) and
DateTime(as: string, storage: timestamp) for the string presets;
Date(as: temporal), Date, Time(as: temporal), Time and
Time(storage: timetz) for the date and time presets. TypeScript writes
type.DateTime({ as: 'temporal' }) and so on. A precision is written by
name, as precision: 3, since a type choice takes it after its options.
The JavaScript Date presets keep TimestamptzJsDate, because DateTime
would add precision 3 the preset did not store.
A row now names its type as a path and options, and applies where that
call resolves, through the type choice resolution a column uses, to the
row's codec. The parity tests take each rewrite from the refusal and
check it stores what the preset stored.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…tzTemporal
Merging the field-preset removal rewrote each old DateTime in the
examples and the telemetry backend to TimestamptzTemporal, so the
contracts stayed the same. ADR 279 says users start from the
convenience type and the tools write it back, and contract print on
these schemas writes DateTime(as: temporal). The sources, the
migration snapshots, and the TypeScript contracts and fragments now
say DateTime(as: temporal) or type.DateTime({ as: 'temporal' }). No
contract.json or hash changes.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
The refusal names the call and what to write in its place. For an
optional field, temporal.createdAt()? got "Write DateTime(as: temporal)
@onCreate(now())", and putting that in place of the call gives
DateTime(as: temporal) @onCreate(now())?, which does not parse.
describeRemovedFieldPreset now takes the field, and every rewrite writes
the field's ? or [] right after the type and before any attribute:
"Write DateTime(as: temporal)? @onCreate(now())". This covers every row,
including the id, nanoid and phase rows and their fallback sentences.
The OptionalCreatedAt parity row has its preset again, so its refusal
is checked.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
… codec
temporal.createdAt() and temporal.updatedAt() each have a PostgreSQL row
and a fallback row for SQLite that writes temporal.CreatedAt or
temporal.UpdatedAt. The fallback had no codec id, so it applied wherever
the alias exists. On PostgreSQL, with a schema that declares DateTime,
the first row is skipped and the fallback told the user to write
temporal.CreatedAt, which there stores TimestamptzJsDate(3), not what
the preset stored.
The fallback rows now carry SQLite's sqlite/datetime@1, in PSL and
TypeScript. Every row has a codec id now, so the codec id is required
and a row applies only where its type stores exactly that codec.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…ot its explicit type
temporal.timestamptzJsDate(3, ...) is exactly DateTime, and (6, ...) DateTime(precision: 6); with no precision it stays TimestamptzJsDate, which DateTime cannot give.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…nfinity advice keeps the column's other arguments
Also moves a fixture doc comment back above its declaration, and the demo fixture writes DateTime(as: temporal).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
…ourney plans a migration with no operations
Main now writes and applies a plan with no operations instead of refusing it, so the codec-only move needs no migration new step.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
opensource-fork-sync Bot
pushed a commit
to cla7aye15I4nd/opensource-prisma__orm
that referenced
this pull request
Oct 29, 2026
…l retro, the renames' exception recorded in ADR 257, follow-ups filed (prisma#30895)
## Linked issue
Closes TML-3709, the project ticket of the Convenience date and time
types project. Every slice has merged: prisma#30834 (ADR 279, ISO
strings, explicit types, Prisma 7 `now()`) and prisma#30847 (the
convenience types, and the tools that write them).
## Summary
```prisma
model Order {
paidAt DateTime // exactly TimestamptzJsDate(3): a JavaScript Date
settleAt DateTime(as: temporal) // exactly TimestamptzTemporal
shipBy Date // exactly DateString: "2024-02-29"
}
```
That is what the project shipped: one PostgreSQL type per concept, each
meaning exactly one explicit type, with defaults that need no Temporal
polyfill. This PR closes the project. It lands the final retro, records
the one decision that had no home yet, removes the last link into the
project folder, and deletes the folder.
### The retro's lessons
The retro entry is in `drive/retro/README.md`. Three lessons became new
failure modes in `drive/calibration/failure-modes.md`, two of them with
a new item in the slice DoD (`drive/calibration/dod.md`):
- **A merge of `main` that resolves an overlapping change is new work**
(failure mode F51). The merge of the field-presets removal resolved 42
conflicted files and was sent for review with no review round of its
own. The round that followed found twelve defects. The slice DoD now
asks for a review of `git diff <main commit> <merge commit>` after such
a merge.
- **A release bump can archive a pending upgrade instruction while a
branch is still editing it** (F52). The branch's edits then land in the
released copy. The slice DoD now checks that `git diff <release commit>
HEAD -- upgrade-instructions/releases/` is empty.
- **When a name changes meaning, check the sources a test emits itself**
(F53). `fixtures:check` does not see them, and one such fixture got the
PR dropped from the merge queue.
The queue also dropped the PR for a journey that `main`'s newest commit
changed. The slice DoD already covers that (F44); it was not walked
before auto-merge.
### The one decision without a home
The project removed `Timestamptz`, `Timestamp` and `Interval` outright,
with no deprecated alias, because they were renamed before the release
candidate. ADR 257 says a renamed PSL name stays as a deprecated alias
for one release line. Its note for ADR 279 now records the exception.
## Project DoD
| Item | Verdict | Evidence |
| --- | --- | --- |
| Every row of the convenience-types table works end to end: emit,
`migration plan` DDL, and reading and writing the value type, with and
without a global `Temporal` | Met | A close-out journey ran all 13 rows.
It covered emit, the planned column types, `db migrate`, then reads in a
process with no `Temporal` and in one with the polyfill. Committed
coverage: `convenience-types.integration.test.ts`,
`convenience-date-time-types-without-temporal.e2e.test.ts`,
`temporal-codec-roundtrip.integration.test.ts`. |
| `prisma orm init` and a `prisma7Schema(...)` project read `Date`
timestamps with no polyfill; a create on a non-UTC server stores UTC |
Met | `prisma7-dates-without-temporal.e2e.test.ts` (includes a session
in Asia/Tokyo). For init, a close-out run of the PSL starter schema read
`createdAt` and `updatedAt` as `Date` with no `Temporal`. The TypeScript
starter is checked by type only. |
| The research report's use-case table re-run against the shipped
surface | Not done | The report is a private artifact that is not in the
repository. |
| ADR 279 accepted; ADR 254, 257 and 275 carry notes; `scalar-types.md`
describes both layers | Met | All on `main`. ADR 257's note gains the
deprecation exception in this PR. |
| TML-3714 and TML-3715 stay open with their context | Met | Both in
Backlog. |
The cross-cutting requirements all hold:
- **Same contract either way:** a close-out run emitted a convenience
schema and its explicit twin through the CLI. The `contract.json` files
were byte-identical, with equal storage, execution and profile hashes.
- **Every argument combination is a listed choice or an error at the
argument.**
- **Every default runs with no polyfill.**
- **Strings round-trip on a non-UTC, non-ISO server:** a close-out run
against a PostgreSQL 17 server started with `DateStyle='German, DMY'`
and `TimeZone='Asia/Tokyo'`.
- **Outright renames.**
- **Upgrade instructions** for every user-visible change.
- **Docs moved with the code.**
Every review thread on the six slice PRs (prisma#30834, prisma#30851,
prisma#30844, prisma#30839, prisma#30847, prisma#30858) is resolved.
**Manual QA:** no slice had a QA plan or QA-run report. The close-out
runs above took the user paths against a real PostgreSQL server and
found no defects.
## Classification
Every tracked file under `projects/datetime-convenience-types/` was
transient and is deleted:
- **`README.md`:** project orientation only.
- **`plan.md` and `handover.md`:** coordination.
- **`slices/*/spec.md`:** slice contracts.
- **`spec.md` and `design-notes.md`:** each carried decisions, and each
decision already has a durable home. ADR 279 records the two layers, the
type choice, the four types and their defaults, the option names, the
TypeScript one-object helpers, what the tools write, and the
alternatives. ADR 254 records the ISO stored form. ADR 159 records that
the driver ensures `DateStyle=ISO`. ADR 257's note records the suffix
rule, and from this PR the outright renames. `scalar-types.md` covers
`temporal-spec` and the missing-`Temporal` error. The non-goals are
TML-3714 and TML-3715.
Nothing migrated to `docs/`, because the long-lived content went into
ADRs and reference docs during the slices.
## References
The scan found one link into the folder outside it:
`projects/target-named-scalars-sql/README.md` line 5. It also called ADR
279 "Proposed". The link now points at ADR 279, and the word is removed.
## Follow-ups filed
- **TML-3765:** the contract package's `missing-property-reads` test
fails on Node 26, on `main` too.
- **TML-3766:** the telemetry backend's handler test expects
`ingestedAt` as a `Date`, but the field reads a Temporal value, on
`main` too.
- **TML-3767:** resolve a type choice call once per field, not in each
reader.
- **TML-3768:** refuse two type choices that name the same explicit
type.
## Checklist
- [x] All commits are signed off.
- [x] Scoped to one logical concern: the project's close-out.
- [x] The PR title is in `TML-NNNN: <sentence-case title>` form.
Agent: sauron-95
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## Summary by CodeRabbit
* **Documentation**
* Clarified that stored types with multiple codecs use names suffixed by
value kind, while unsuffixed concept names refer to convenience types
that resolve to those suffixed types.
* Documented that PostgreSQL date and time names changed before the
release candidate without a deprecated-alias release, and provided
upgrade instructions. Other renamed PSL names remain available as
deprecated aliases for one release line.
* Updated merge, release-instruction, and test-checking guidance, and
added a retrospective covering recent process outcomes.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
opensource-fork-sync Bot
pushed a commit
to cla7aye15I4nd/opensource-prisma__orm
that referenced
this pull request
Oct 29, 2026
…risma#30901)
## Linked issue
Fixes TML-3765 and TML-3766.
## Summary
Two package tests failed on `main`. In both, the test was wrong and the
code was right, so only the tests change.
```text
FAIL test/missing-property-reads.test.ts > leaves the object plain: its prototype, keys, copies and inspection
- "{ column: [Function: column] }",
+ "Proxy({ column: [Function: column] })",
FAIL test/handler.test.ts > accepts events carrying the required-set, optional fields, ...
AssertionError: expected Temporal.Instant{ ... } to be an instance of Date
```
### The contract package's `missing-property-reads` test (Node 26)
`answerMissingPropertyReads` returns a proxy over the field helpers. The
test compared `util.inspect(helpers)` with the exact string `{ column:
[Function: column] }`. Node 26 prints any proxy as `Proxy({ ... })`,
even with `showProxy: false`, so the comparison fails there. CI runs
Node 24, which prints the bare object, so CI passed.
`inspect` never runs a proxy's traps on either version, so the check can
only test that printing the helpers shows their contents. It now asserts
that the output contains `{ column: [Function: column] }`. That passes
on Node 24 and 26 and still fails if inspection stops showing the
helpers.
### The telemetry backend's `ingestedAt` (TML-3766)
The handler test expected `row.ingestedAt` to be a `Date`. The contract
declares `ingestedAt DateTime(as: temporal)`. Before prisma#30847 it
was the bare `DateTime`, which then meant the Temporal type, and prisma#30847
added `as: temporal` on purpose so the column stayed the same. The row
holds a `Temporal.Instant`, so the test was stale.
The test now checks the value's type tag,
`Object.prototype.toString.call(row.ingestedAt) === '[object
Temporal.Instant]'`. Node has no global `Temporal` (the Postgres target
supplies a polyfill), and the app does not depend on the polyfill, so
the test cannot use `toBeInstanceOf(Temporal.Instant)`. The tag is set
by the Temporal spec. A `Date` gives `[object Date]` and fails.
## Testing
- Both tests fail on unchanged `main` (Node 26.8.1) and pass with this
change.
- `pnpm test --coverage`, `pnpm lint` and `pnpm typecheck` pass in
`packages/1-framework/2-authoring/contract` and
`apps/telemetry-backend`.
## Alternatives considered
- **Pass `{ showProxy: false }` to `inspect`.** Node 26 still prints
`Proxy(...)` with it.
- **Change `ingestedAt` to `DateTime` so it reads a `Date`.** That
changes the column type to `timestamptz(3)`, needs a migration and a
deploy of the telemetry backend, and reverses what prisma#30847 chose to keep.
Nothing in the app reads `ingestedAt`, so there is no reason to.
- **Compare `ingestedAt` with the test's clock.** It would also check
the `now()` default, but the database clock can differ from the test's,
which could make the test flaky.
Agent: zeno-78
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## Summary by CodeRabbit
* **Tests**
* Updated validation for accepted telemetry events to recognize the
timestamp representation used by the system.
* Adjusted inspection-output checks to verify expected text without
requiring an exact match of the entire output.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
opensource-fork-sync Bot
pushed a commit
to cla7aye15I4nd/opensource-prisma__orm
that referenced
this pull request
Oct 30, 2026
`8.0.0-rc.21` → `8.0.0-rc.22`. See
[versioning](https://github.com/prisma/orm/blob/main/docs/oss/versioning.md).
**Publishing was broken and is fixed.** From 23 October every `Publish
to npm` run on `main` failed with `ENEEDAUTH` on three packages that had
never been on npm: `@prisma/orm-mysql`, `@prisma/orm-target-mysql`
(prisma#30856) and `@prisma/orm-postgres-contrib` (prisma#30904). Trusted publishing
cannot authenticate a package that does not exist yet. They were
published once by hand and given a trusted publisher; the re-run of run
41053844815 then published all three from CI. The failed runs had also
skipped the rc.21 git tag and GitHub Release, which the upgrade-coverage
check needs to find the previous release.
[`v8.0.0-rc.21`](https://github.com/prisma/orm/releases/tag/v8.0.0-rc.21)
now exists at the rc.21 release commit `fad17c1d03`.
**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.22` under the `latest` dist-tag and creates a pre-release
GitHub Release.
## What to review
- **Release notes:**
[`docs/releases/v8.0.0-rc.22.md`](https://github.com/prisma/orm/blob/release/8.0.0-rc.22/docs/releases/v8.0.0-rc.22.md),
mirrored in `CHANGELOG.md`. Seven breaking changes: the PostgreSQL
convenience date and time types (prisma#30847), value objects in storage
(prisma#30869), the MongoDB execution context (prisma#30865), the MongoDB driver
descriptor (prisma#30906), packs declaring their Postgres extension (prisma#30902),
one installed copy of Prisma ORM (prisma#30883) and merged MongoDB indexes
(prisma#30894). Six features and two fixes. The notes leave out prisma#30728
(telemetry backend), prisma#30891 (CI), prisma#30901 (tests), and prisma#30862, prisma#30895,
prisma#30897 and prisma#30898 (docs only).
- **Upgrade guides:**
`skills/prisma-8/upgrading/{app,extension}/upgrades/8.0.0-rc.21-to-8.0.0-rc.22/instructions.md`,
assembled from the fifteen pending fragments (the fifteenth, from
prisma#30918, declares no change). The app guide has 19 changes plus the
Supabase restamp, opens with the order to do the steps in, and ships one
script (`value-objects-in-storage`). The extension guide has 16 changes.
None was dropped. The originals are archived unchanged under
`upgrade-instructions/releases/8.0.0-rc.21-to-8.0.0-rc.22/sources/`.
- **Corrections made while assembling:**
- `mongo-runtime-takes-adapter` said `createMongoExecutionStack()` no
longer takes a `driver`. prisma#30906, merged later, gave it one back, and the
driver entry tells you to pass it. The entry now says what `main` does,
and its detection no longer flags a stack built with a driver.
- The convenience types entry now says to leave a `DateTime(as: ...)`
field alone, and the step order renames the old types before rewriting
the `temporal.*` aliases. Otherwise an agent would rename the
`DateTime(as: temporal)` the alias table writes.
- References to "this release's guide" now name the rc.20 → rc.21 guide
they meant.
- **Tests:** the upgrade-instruction tests read the published guides and
script. The `value-objects-in-storage` tests no longer call live
framework code: the two tests that checked the fixtures against this
release's serializers are removed, and the one hash they computed is a
recorded constant.
- **Version bump:** every `package.json`, `pnpm-lock.yaml` (workspace
specifiers only), the skill's `library_version`, and the Supabase
contract version stamps.
## Checks run locally
- `check:upgrade-coverage --mode publish --prev fad17c1 --head HEAD`:
pass. The `--mode pr` form CI runs passes now that the tag exists.
- `check:release-notes --mode pr`: pass
- `lint:skills`: pass
- `test/upgrade-instructions`: 102 files, 1,980 tests pass
The prisma/web docs PR follows once this is published.
Agent: paddington-54
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## Summary by CodeRabbit
* **New Features**
* Added repeatable client `connect()` behavior, PostgreSQL extension
declarations and additional types, plus MySQL ORM and SQL-builder read
support.
* **Breaking Changes**
* PostgreSQL date/time defaults and types, value-object storage, MongoDB
APIs and indexes, and extension-pack migrations have changed. Review the
upgrade guidance before updating.
* **Bug Fixes**
* Improved precision for PostgreSQL `now()` values and clarified Prisma
7 `@db.*` diagnostics.
* **Documentation**
* Added Prisma 8.0.0-rc.22 release notes and upgrade instructions.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Reviewers
wmadden
wmadden approved these changes
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|