Skip to content

TML-3713: contract infer, contract print, the Prisma 7 reader and orm init write the convenience date and time types - #30858

Merged
wmadden-electric merged 35 commits into
tml-3712-convenience-date-time-typesfrom
tml-3713-tools-write-convenience-types
Oct 23, 2026
Merged

wmadden-electric merged 35 commits into
tml-3712-convenience-date-time-typesfrom
tml-3713-tools-write-convenience-types

Conversation

@wmadden-electric

@wmadden-electric wmadden-electric commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Linked issue

Fixes TML-3713. Part of the Convenience date and time types project (TML-3709); stacked on the convenience types PR, #30847. It also merges in the Prisma 7 now() defaults PR, #30839, so the diff shows that change too; review it there.

Summary

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(column: timestamp)   // TimestampJsDate(3)
  day     Date                          // DateString
  opens   Time(precision: 0)            // TimeString(0)
  localAt Time(column: timetz)          // Timetz
  span    Duration                      // IntervalString
}

The decision: the tools that write a schema for you (contract infer, contract print, the Prisma 7 schema reader and prisma orm init) write the convenience date and time types, choosing the convenience default wherever it fits the column. The schema above emits, db verify finds nothing, and the planner plans nothing. ADR 279 ("What the tools write") is the design.

Why

The convenience types (#30847) only help if the schemas users start from use them. A schema infer writes should read like one a user would write, and the default path should be the one users see first.

Infer and print write the shortest convenience call

For each column, infer picks the explicit type the convenience default gives, then writes the shortest convenience call that becomes it. It writes the explicit type only when no convenience call does, for example a timestamp read as Temporal.PlainDateTime (TimestampTemporal). contract print writes the same forms; it compares parameters exactly, so it reproduces a contract byte for byte.

One framework helper does this for both, beside the type-choice resolver: given an explicit constructor call, it finds the type-choice row that names it, builds the arguments by name, drops those equal to the defaults, and re-resolves to prove the call gives the same codec and parameters.

A column with no precision compares equal to precision 6

PostgreSQL stores microseconds either way, so the date and time data types now treat an omitted precision as 6 when columns are compared (their normal form). That is what lets infer write DateTime(precision: 6) for a bare timestamptz and still verify clean. Two things keep the precision as written:

  • the check the planner runs after ADD COLUMN or ALTER COLUMN TYPE compares PostgreSQL's format_type with the type as written, because PostgreSQL prints a bare timestamptz as timestamp with time zone, not timestamp(6) with time zone. A SQL data type may declare catalogParams for this; MySQL's datetime declares none.
  • db verify messages show a bare column as timestamptz.

ADR 254's sentence on that check now says the catalog text is for the type as written. No stored contract, hash or committed plan changes.

The Prisma 7 reader, the aliases and orm init

  • The Prisma 7 reader picks the same types: DateTime becomes TimestampJsDate(3) (printed DateTime(column: timestamp)), and @db.Timestamptz(p), @db.Date, @db.Time(p) and @db.Timetz(p) 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 what bare DateTime gives; 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.

A Date cannot hold digits below a millisecond

A JavaScript Date holds milliseconds. ADR 254 already says a codec refuses a stored value its application value cannot hold exactly; the Date codecs dropped the extra digits instead. Now:

  • The Postgres timestamptz and timestamp Date codecs and MySQL's datetime Date codec refuse, in fromDataTypeValue, a stored value with digits below a millisecond, naming the types that hold it. So @default(timestamptz2024-01-01T01:00:00.123456Z) on a DateTime field is refused at authoring. Reading and writing rows is unchanged: a row with microseconds still reads as a Date at the millisecond.
  • contract infer prints a reported default as a literal only when the codec reads it exactly, as it already does for JSON numbers; a microsecond default is printed as its raw SQL expression, which keeps every digit in DDL.
  • The Prisma 7 reader writes no SQL. For a default the codec refuses, single or list, it asks the target binding (refusedLiteralDefault); the Postgres binding writes '2024-01-02T03:04:05.123456'::timestamp(6) or ARRAY[...]::timestamp(6)[]. ADR 252 lists the new binding member.
  • On a column read as a Date, db verify reads both defaults as the application reads them, so a difference below a millisecond is not reported. ADR 254 and scalar-types.md say so.

The TypeScript builder cannot write such a default at all: .default() on a Date field takes a Date.

The framework vocabulary limit goes from 237 to 238

The lint counts target words such as column in packages/1-framework. The PostgreSQL TypeScript starter that orm init writes lives in the CLI package and now contains field.column(type.DateTime()); the template is one string, so the occurrence can't be shared with an existing one. The same templates are already counted for the same reason.

Testing performed

  • contract infer on the table above writes exactly that schema; it emits, db verify --strict finds nothing, the planner plans nothing.
  • A microsecond default: infer prints the raw expression; a database migrated from it holds .123456 (checked in information_schema and an inserted row); the Prisma 7 tsMicro and list ts6l fixtures migrate and verify clean; signed years write SQL PostgreSQL accepts. A PSL .123456 default on DateTime is refused; .123 is accepted.
  • Postcheck text against PGlite: a bare timestamptz checks as timestamp with time zone, timestamptz(6) as timestamp(6) with time zone.
  • Package tests with coverage, typecheck and lint: framework-components, sql-contract, family-sql, contract-psl, contract-prisma7, target-postgres, adapter-postgres, target-mysql, CLI, postgres facade.
  • Integration: 2804 tests across psl-infer, psl-print, temporal-defaults, authoring parity, prisma7-source, convenience-date-time-types, date-time-defaults, init-templates, infer round trip, db-introspect, upgrade-instructions. Journeys: 79 tests in 27 files. examples/prisma7-adoption tests.
  • pnpm fixtures:check, pnpm lint:deps, pnpm lint:ratchets, pnpm lint:docs, pnpm check:upgrade-coverage --mode pr.

Skill update

skills/prisma-8 (contract.md, the infer part of quickstart.md) describes what infer writes. Upgrade instructions in upgrade-instructions/pending/tools-write-convenience-types/app/: 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 with a string or Temporal type or a sql expression. The Prisma 7 now() defaults instruction now names DateTime(column: timestamp).

Checklist

  • All commits are signed off.
  • Scoped to one logical concern.
  • 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

  • Ten Prisma 7 fixtures changed codec and hash; examples/prisma7-adoption has a re-emitted contract and a new signed snapshot, and its code reads a Date.
  • A contract emitted before this change with a microsecond literal on a Date column fails when a migration is planned, until it is re-authored.

Alternatives considered:

  • Infer writes the string types for microsecond columns, which lose nothing. Nothing is lost, but the schema differs from what a user would write; ADR 279 records the choice of the default path.
  • Store an omitted precision as 6 in the contract. It would change existing contracts and hashes; comparing in normal form changes none.
  • A data type reads the database's text of its defaults. ADR 254 rejected it: that text is what a row arrives in, and the codec reads it. Refusing in the codec follows the rule ADR 254 already states.
  • Compare a timestamp default with the full value the column holds in db verify. It needs a per-type reader beside the codec, and its first version compared one side at full precision and the other through the codec.

Agent: thales-11

🤖 Generated with Claude Code

wmadden-electric and others added 28 commits October 22, 2026 18:04
…'s client did

Prisma 7 filled @default(now()) on the client and also wrote the database
default. The reader kept only the database default, so a create through
Prisma 8 got the database's clock in the session time zone. The reader now
also resolves the now generator for the column's codec through the generator
function registry, and refuses @default(now()) on a column no now generator
fills.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…rough Prisma 8

A raw INSERT on the same session still gets the database default, in Tokyo
wall-clock time.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…enerator on create

The storage hash is unchanged; the execution hash changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…efault and a now generator on create

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…@default(now()) now writes on create

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
… create for @default(now())

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…der's contracts, without a ticket reference

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…nd nothing for extension authors

The marker holds only the storage and profile hashes, and the storage hash does
not change, so db sign does nothing here.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…eld's own terms

The refusal names the field type the user wrote, or the native type that makes
the column not a date or time, says Prisma 7 refuses the schema too, and says
what to change, like the reader's other refusals.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
The Tokyo case now asserts +9 hours on the connection the application's
creates run on, instead of checking a separate connection.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…a list field

now(), uuid() and the other functions fill one value, so on a list column
they gave a scalar generator or a column default PostgreSQL rejects. The
refusal says to write a list literal instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…and test the list-field rule on its own

The one-member set and the helper that took a function name are replaced by a
check for now() and a now-specific refusal. The rule that refuses a function
default other than dbgenerated on a list field gets its own tests, for
autoincrement(), uuid() and now().

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…ecomes it

findAuthoringTypeChoiceCall finds the first type choice whose row names the
constructor, builds its arguments by name from the row and the call, leaves
out every argument whose omission still gives the same codec and parameters,
and finds nothing when no call to the choice reproduces them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…sion 6

PostgreSQL stores microseconds whether a timestamptz, timestamp, time, timetz
or interval column declares precision 6 or none, so the normal form of these
data types counts an omitted precision as 6, and db verify and the planner see
no difference between the two.

The catalog text a migration postcheck compares with format_type is now the
text for the type as written: PostgreSQL prints a bare timestamptz as
timestamp with time zone, not with a precision. The normal form is used only
where no catalog text takes the written parameters, as numeric(10) prints
numeric(10,0). Contracts keep their parameters as written, so no stored
contract 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]>
… types

Each date and time data type now marks the explicit type its convenience
default gives: TimestamptzJsDate, TimestampJsDate and IntervalString instead
of the string and parts types. contract infer picks that type and writes the
convenience call that becomes it, by name and with only the arguments that
differ from the defaults, so a timestamptz(3) column is DateTime and a
timestamptz with no declared precision is DateTime(precision: 6). contract
print writes the convenience call wherever one becomes the column's explicit
type exactly, and the explicit type otherwise, as for a timestamp read as
Temporal.PlainDateTime.

A Date holds milliseconds, so a timestamp default with more digits, or
infinity, keeps its raw SQL expression rather than a default a millisecond
off.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…enience date and time types

prisma7Schema reads a Prisma 7 DateTime as TimestampJsDate(3), printed
DateTime(column: timestamp), and @db.Timestamptz(p) as TimestamptzJsDate(p),
so an adopted application reads a JavaScript Date as Prisma 7 gave it, and
@updatedat and @default(now()) write a Date.

temporal.CreatedAt and temporal.UpdatedAt are built on the type bare DateTime
becomes, and their String and JsDate variants are removed. orm init writes
createdAt DateTime @default(now()) @onCreate(now()) and updatedAt
temporal.UpdatedAt, in PSL and in TypeScript.

db verify compares a timestamp default with the value the column holds, not
with a Date codec's millisecond reading of it, so a Prisma 7 database with a
microsecond default still verifies clean.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…rade instructions

The example re-emits its contract, records the signed snapshot of the new
storage hash, and prints updatedAt from the Date it now reads. The upgrade
instructions give the re-emit, db sign and code change for prisma7Schema
projects, and the rewrite of each removed created-at and updated-at alias.
The earlier instruction for the Prisma 7 now() default names the type the
reader now picks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
… leave it

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, the gotcha about Prisma 7 dates, the Prisma 7
reader, PSL, TypeScript and Postgres target READMEs, ADR 275's alias note and
the prisma-8 skill now say what contract infer, contract print, prisma7Schema
and orm init write, that an omitted precision compares equal to 6, that a Date
drops microseconds, and that the created-at and updated-at aliases are on
DateTime.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…bulary ratchet

The Postgres TypeScript starter that orm init writes now types its timestamps
with field.column(type.DateTime()) and field.column(type.temporal.UpdatedAt()).
The starter is Postgres code held as a template string in the CLI, and its
body is one template chunk with no earlier counted occurrence to share, so the
threshold rises from 237 to 238.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
renderSqlCatalogText rendered the text for the parameters as written whenever
a catalog text took them, which is how PostgreSQL prints a type but not how
every database does: MySQL prints datetime(0) as datetime. A SQL data type may
now declare catalogParams, the parameters its catalog prints for those
written, and the normal form is used where it declares none. The Postgres date
and time types declare that the precision is printed as written.

The contract side of the schema tree uses the same parameters, so a bare
timestamptz column shows as timestamptz in verify messages rather than
timestamptz(6), and the infer test fixtures report catalog text as PostgreSQL
prints it for the type as written.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
findAuthoringTypeChoiceCall now also returns the type constructor call the
type choice call resolves to, and contract infer records that call for the
column's default checks. A bare time column is written Time and recorded as
TimeString with no precision, as emit reads it, instead of with the precision
6 of the column's normal form.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
A codec refuses in fromDataTypeValue a value its application value cannot
hold exactly. The Postgres timestamptz and timestamp Date codecs and MySQL's
datetime Date codec now do so for digits below a millisecond, naming the text
and Temporal types that hold them, so a PSL default such as
timestamptz`2024-01-01T01:00:00.123456Z` on a DateTime field is refused at
authoring. Reading a row is unchanged: fromWire still gives the Date at the
millisecond. A TypeScript contract cannot write such a default, because
.default() on a Date field takes a Date.

contract infer prints a reported timestamp default as a literal only when the
codec reads it exactly, beside the existing JSON check, and otherwise prints
the raw expression. db verify reads both sides through the codec again, so an
inferred microsecond default verifies clean and plans nothing; the adapter's
held-value comparison and its helper are removed.

The default reader reports the codec's refusal as its own kind carrying the
stored value, or for a list every element. The Prisma 7 target binding gains
refusedLiteralDefault, which writes that default's SQL; the Postgres binding
writes a quoted literal cast to the column type, or ARRAY[...]::type[] for a
list. A Prisma 7 DateTime default with microseconds still loads, and a
database Prisma 8 migrates from it holds every digit and verifies clean.

The upgrade instruction says what to write for a PSL default on a Date field
with digits below a millisecond.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
… refused list element

The Postgres Prisma 7 binding writes a date or time default with the year text
PostgreSQL reads, through postgresYearText, so a year before 1 or after 9999
is written 0044-03-15T00:00:00.123456 BC or 10000-01-01T00:00:00.123456Z,
not with a signed year PostgreSQL rejects.

contract infer prints the raw expression when the column's type does not read
a body its codec read, instead of throwing.

A PSL list default with an element the codec refuses and a later element
refused for another reason is reported at the first.

ADR 254 says a Date column's defaults are compared as the application reads
them, so a difference below a millisecond is not reported.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
wmadden-electric requested a review from a team as a code owner October 23, 2026 08:44
@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
📥 Commits

Reviewing files that changed from the base of the PR and between dc5f8c8 and be6af64.

⛔ Files ignored due to path filters: 10
  • examples/prisma7-adoption/generated/prisma8/contract.d.ts is excluded by !**/generated/**
  • examples/prisma7-adoption/generated/prisma8/contract.json is excluded by !**/generated/**
  • packages/1-framework/3-tooling/cli/test/commands/init/__snapshots__/templates.test.ts.snap is excluded by !**/*.snap
  • projects/datetime-convenience-types/plan.md is excluded by !projects/**
  • test/integration/test/temporal-defaults/_fixture-aliases/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/temporal-defaults/_fixture-aliases/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/temporal-defaults/_fixture-attributes/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/temporal-defaults/_fixture-attributes/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/temporal-defaults/_fixture-now/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/temporal-defaults/_fixture-now/generated/contract.json is excluded by !**/generated/**
📒 Files selected for processing: 57
  • docs/architecture docs/adrs/ADR 275 - Client generators are field attributes, and a type alias is expanded into each column.md
  • docs/reference/error-reference.md
  • docs/reference/scalar-types.md
  • examples/prisma7-adoption/README.md
  • gotchas.md
  • packages/1-framework/1-core/framework-components/src/exports/authoring.ts
  • packages/2-sql-family/2-authoring/contract-prisma7/README.md
  • packages/2-sql-family/2-authoring/contract-prisma7/src/defaults.ts
  • packages/2-sql-family/2-authoring/contract-prisma7/src/interpreter.ts
  • packages/2-sql-family/2-authoring/contract-prisma7/test/fixtures/defaults/expected-contract.json
  • packages/2-sql-family/2-authoring/contract-prisma7/test/fixtures/updated-at-optional/expected-contract.json
  • packages/2-sql-family/2-authoring/contract-prisma7/test/fixtures/updated-at-with-default/expected-contract.json
  • packages/2-sql-family/2-authoring/contract-prisma7/test/fixtures/updated-at/expected-contract.json
  • packages/2-sql-family/2-authoring/contract-prisma7/test/now-default-generators.test.ts
  • packages/2-sql-family/2-authoring/contract-prisma7/test/updated-at-generators.test.ts
  • packages/2-sql-family/2-authoring/contract-psl/README.md
  • packages/2-sql-family/2-authoring/contract-ts/README.md
  • packages/2-sql-family/9-family/src/core/timestamp-now-runtime-generator.ts
  • packages/2-sql-family/9-family/test/timestamp-now-runtime-generator.test.ts
  • packages/3-targets/postgres/1-target/README.md
  • packages/3-targets/postgres/1-target/src/core/authoring.ts
  • packages/3-targets/postgres/1-target/src/core/date-codecs.ts
  • packages/3-targets/postgres/1-target/src/core/date-time-now-generators.ts
  • packages/3-targets/postgres/1-target/src/core/errors.ts
  • packages/3-targets/postgres/1-target/src/core/now-generators.ts
  • packages/3-targets/postgres/1-target/src/core/psl-print/column-types.ts
  • packages/3-targets/postgres/1-target/src/core/type-constructors.ts
  • packages/3-targets/postgres/1-target/test/authoring-field-presets.test.ts
  • packages/3-targets/postgres/1-target/test/date-time-text-wording.test.ts
  • packages/3-targets/postgres/1-target/test/generator-functions.test.ts
  • packages/3-targets/postgres/1-target/test/now-generators.test.ts
  • packages/3-targets/postgres/1-target/test/psl-infer/infer-column-types.test.ts
  • packages/3-targets/postgres/1-target/test/psl-infer/infer-parse-emit.test.ts
  • packages/3-targets/postgres/1-target/test/psl-infer/inferred-psl/inferred-psl.literal-defaults.test.ts
  • packages/3-targets/postgres/1-target/test/psl-print/convenience-types.test.ts
  • packages/3-targets/postgres/1-target/test/psl-print/generated-values.test.ts
  • packages/3-targets/postgres/1-target/test/temporal-unavailable.test.ts
  • scripts/framework-vocabulary-thresholds.json
  • skills/prisma-8/references/contract.md
  • skills/prisma-8/references/quickstart.md
  • test/integration/test/cli-journeys/control-plane-commands-without-temporal.e2e.test.ts
  • test/integration/test/cli-journeys/date-time-default-canonical-form.e2e.test.ts
  • test/integration/test/cli-journeys/infer-roundtrip-fidelity.prisma7-defaults.e2e.test.ts
  • test/integration/test/cli-journeys/prisma7-dates-without-temporal.e2e.test.ts
  • test/integration/test/convenience-date-time-types/sub-millisecond-defaults.test.ts
  • test/integration/test/infer-roundtrip-runtime.integration.test.ts
  • test/integration/test/psl-infer/convenience-types-infer.integration.test.ts
  • test/integration/test/psl-print/date-time-types-print.integration.test.ts
  • test/integration/test/psl-print/generated-values-roundtrip.integration.test.ts
  • test/integration/test/psl-print/prisma7-convenience-types-print.integration.test.ts
  • test/integration/test/temporal-defaults/_fixture-attributes/contract.prisma
  • test/integration/test/temporal-defaults/_fixture-now/contract.prisma
  • test/integration/test/temporal-defaults/now-generators-readback.integration.test.ts
  • test/integration/test/temporal-defaults/type-aliases-parity.test.ts
  • test/integration/test/upgrade-instructions/tools-write-convenience-types/detection.test.ts
  • upgrade-instructions/pending/prisma7-now-default-on-create/app/instructions.md
  • upgrade-instructions/pending/tools-write-convenience-types/app/instructions.md
+-------------------------------------------------+
| PhD, MSc, BSc, and a black belt in code review. |
+-------------------------------------------------+
  \
   \   (\__/)
       (•ㅅ•)
       /   づ

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
📥 Commits

Reviewing files that changed from the base of the PR and between 55d7024 and dc5f8c8.

⛔ Files ignored due to path filters: 8
  • examples/prisma7-adoption/generated/prisma8/contract.d.ts is excluded by !**/generated/**
  • examples/prisma7-adoption/generated/prisma8/contract.json is excluded by !**/generated/**
  • packages/1-framework/3-tooling/cli/test/commands/init/__snapshots__/templates.test.ts.snap is excluded by !**/*.snap
  • projects/datetime-convenience-types/plan.md is excluded by !projects/**
  • projects/datetime-convenience-types/slices/01-iso-strings/spec.md is excluded by !projects/**
  • projects/datetime-convenience-types/slices/05-tools-write-convenience-types/spec.md is excluded by !projects/**
  • test/integration/test/temporal-defaults/_fixture-aliases/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/temporal-defaults/_fixture-aliases/generated/contract.json is excluded by !**/generated/**
📒 Files selected for processing: 114
  • docs/architecture docs/adrs/ADR 252 - An earlier Prisma version's schema is a contract source.md
  • docs/architecture docs/adrs/ADR 254 - Data types and casts.md
  • docs/architecture docs/adrs/ADR 275 - Client generators are field attributes, and a type alias is expanded into each column.md
  • docs/reference/scalar-types.md
  • examples/prisma7-adoption/README.md
  • examples/prisma7-adoption/migrations/app/refs/db.json
  • examples/prisma7-adoption/migrations/snapshots/97963644c7d9359d5e31879ed1c6bfdc39b666d0fd1d0f152525b055d3c574c3/contract.d.ts
  • examples/prisma7-adoption/migrations/snapshots/97963644c7d9359d5e31879ed1c6bfdc39b666d0fd1d0f152525b055d3c574c3/contract.json
  • examples/prisma7-adoption/migrations/snapshots/cee288aa57be618663c6c6118ece25e6ae2049027a7337e8e04c1742faedfff3/contract.json
  • examples/prisma7-adoption/src/main.ts
  • examples/prisma7-adoption/test/adoption.test.ts
  • gotchas.md
  • packages/1-framework/1-core/framework-components/README.md
  • packages/1-framework/1-core/framework-components/src/exports/authoring.ts
  • packages/1-framework/1-core/framework-components/src/shared/authoring-type-choice-call.ts
  • packages/1-framework/1-core/framework-components/src/shared/authoring-type-constructor-call.ts
  • packages/1-framework/1-core/framework-components/src/shared/framework-authoring.ts
  • packages/1-framework/1-core/framework-components/test/authoring-type-choice-call.test.ts
  • packages/1-framework/3-tooling/cli/src/commands/init/templates/code-templates.ts
  • packages/1-framework/3-tooling/cli/test/commands/init/templates.test.ts
  • packages/2-sql-family/1-core/contract/src/exports/data-type.ts
  • packages/2-sql-family/1-core/contract/src/sql-data-type.ts
  • packages/2-sql-family/1-core/contract/test/sql-data-type-fixtures.ts
  • packages/2-sql-family/1-core/contract/test/sql-data-type.render.test.ts
  • packages/2-sql-family/1-core/contract/test/sql-data-type.resolve-written.test.ts
  • packages/2-sql-family/2-authoring/contract-prisma7/README.md
  • packages/2-sql-family/2-authoring/contract-prisma7/src/defaults.ts
  • packages/2-sql-family/2-authoring/contract-prisma7/src/interpreter.ts
  • packages/2-sql-family/2-authoring/contract-prisma7/src/target-binding.ts
  • packages/2-sql-family/2-authoring/contract-prisma7/test/defaults.test.ts
  • packages/2-sql-family/2-authoring/contract-prisma7/test/fixtures/datetime-defaults/expected-contract.json
  • packages/2-sql-family/2-authoring/contract-prisma7/test/fixtures/defaults/expected-contract.json
  • packages/2-sql-family/2-authoring/contract-prisma7/test/fixtures/ignored-field-defaults/expected-contract.json
  • packages/2-sql-family/2-authoring/contract-prisma7/test/fixtures/list-defaults/expected-contract.json
  • packages/2-sql-family/2-authoring/contract-prisma7/test/fixtures/native-types-accepted/expected-contract.json
  • packages/2-sql-family/2-authoring/contract-prisma7/test/fixtures/native-types-without-arguments/expected-contract.json
  • packages/2-sql-family/2-authoring/contract-prisma7/test/fixtures/scalars/expected-contract.json
  • packages/2-sql-family/2-authoring/contract-prisma7/test/fixtures/updated-at-optional/expected-contract.json
  • packages/2-sql-family/2-authoring/contract-prisma7/test/fixtures/updated-at-with-default/expected-contract.json
  • packages/2-sql-family/2-authoring/contract-prisma7/test/fixtures/updated-at/expected-contract.json
  • packages/2-sql-family/2-authoring/contract-prisma7/test/list-field-function-defaults.test.ts
  • packages/2-sql-family/2-authoring/contract-prisma7/test/now-default-generators.test.ts
  • packages/2-sql-family/2-authoring/contract-prisma7/test/sub-millisecond-defaults.test.ts
  • packages/2-sql-family/2-authoring/contract-prisma7/test/updated-at-generators.test.ts
  • packages/2-sql-family/2-authoring/contract-psl/README.md
  • packages/2-sql-family/2-authoring/contract-psl/src/data-type-default.ts
  • packages/2-sql-family/2-authoring/contract-ts/README.md
  • packages/2-sql-family/9-family/README.md
  • packages/2-sql-family/9-family/src/core/migrations/contract-to-schema-ir.ts
  • packages/2-sql-family/9-family/src/core/psl-build/column-types.ts
  • packages/2-sql-family/9-family/src/core/psl-build/inferred-type-constructors.ts
  • packages/2-sql-family/9-family/src/exports/psl-build.ts
  • packages/2-sql-family/9-family/test/contract-to-schema-ir.test.ts
  • packages/2-sql-family/9-family/test/psl-build/inferred-type-constructors.test.ts
  • packages/3-targets/mysql/1-target/src/core/codecs.ts
  • packages/3-targets/mysql/1-target/test/codecs.test.ts
  • packages/3-targets/postgres/1-target/README.md
  • packages/3-targets/postgres/1-target/src/core/authoring.ts
  • packages/3-targets/postgres/1-target/src/core/data-types.ts
  • packages/3-targets/postgres/1-target/src/core/date-codecs.ts
  • packages/3-targets/postgres/1-target/src/core/migrations/planner-sql-checks.ts
  • packages/3-targets/postgres/1-target/src/core/prisma7-binding.ts
  • packages/3-targets/postgres/1-target/src/core/psl-build/psl-literals.ts
  • packages/3-targets/postgres/1-target/src/core/psl-infer/infer-model-blocks.ts
  • packages/3-targets/postgres/1-target/src/core/psl-infer/infer-psl-contract.ts
  • packages/3-targets/postgres/1-target/src/core/psl-infer/infer-read-defaults.ts
  • packages/3-targets/postgres/1-target/src/core/psl-infer/junction-relation-field-names.ts
  • packages/3-targets/postgres/1-target/src/core/psl-print/column-types.ts
  • packages/3-targets/postgres/1-target/src/core/type-constructors.ts
  • packages/3-targets/postgres/1-target/test/data-type-texts.test.ts
  • packages/3-targets/postgres/1-target/test/date-codecs.sub-millisecond.test.ts
  • packages/3-targets/postgres/1-target/test/existing-column-types-without-temporal.test.ts
  • packages/3-targets/postgres/1-target/test/migrations/alter-type-check.test.ts
  • packages/3-targets/postgres/1-target/test/migrations/column-type-comparison.test.ts
  • packages/3-targets/postgres/1-target/test/prisma7-binding.refused-defaults.test.ts
  • packages/3-targets/postgres/1-target/test/prisma7-type-map.test.ts
  • packages/3-targets/postgres/1-target/test/psl-build/marked-type-constructors.test.ts
  • packages/3-targets/postgres/1-target/test/psl-infer/fixtures.ts
  • packages/3-targets/postgres/1-target/test/psl-infer/infer-column-types.test.ts
  • packages/3-targets/postgres/1-target/test/psl-infer/infer-parse-emit.test.ts
  • packages/3-targets/postgres/1-target/test/psl-infer/inferred-psl.round-trip.test.ts
  • packages/3-targets/postgres/1-target/test/psl-infer/inferred-psl/inferred-psl.core.test.ts
  • packages/3-targets/postgres/1-target/test/psl-infer/inferred-psl/inferred-psl.data-type-defaults.test.ts
  • packages/3-targets/postgres/1-target/test/psl-infer/inferred-psl/inferred-psl.defaults-and-types.test.ts
  • packages/3-targets/postgres/1-target/test/psl-infer/inferred-psl/inferred-psl.literal-defaults.test.ts
  • packages/3-targets/postgres/1-target/test/psl-print/convenience-types.test.ts
  • packages/3-targets/postgres/1-target/test/psl-print/generated-values.test.ts
  • packages/3-targets/postgres/1-target/test/type-constructors.test.ts
  • packages/3-targets/postgres/2-adapter/test/migrations/add-date-time-column-postcheck.integration.test.ts
  • packages/3-targets/postgres/9-facade/README.md
  • packages/3-targets/postgres/9-facade/test/contract-builder/type-helpers.test-d.ts
  • scripts/framework-vocabulary-thresholds.json
  • skills/prisma-8/references/contract.md
  • skills/prisma-8/references/quickstart.md
  • test/integration/test/authoring/parity/temporal-type-aliases.real-packs.test.ts
  • test/integration/test/cli-journeys/control-plane-commands-without-temporal.e2e.test.ts
  • test/integration/test/cli-journeys/date-time-default-canonical-form.e2e.test.ts
  • test/integration/test/cli-journeys/infer-roundtrip-fidelity.brace-array-defaults.e2e.test.ts
  • test/integration/test/cli-journeys/infer-roundtrip-fidelity.prisma7-defaults.e2e.test.ts
  • test/integration/test/cli-journeys/prisma7-dates-without-temporal.e2e.test.ts
  • test/integration/test/convenience-date-time-types/sub-millisecond-defaults.test.ts
  • test/integration/test/infer-roundtrip-runtime.integration.test.ts
  • test/integration/test/prisma7-source/refused-defaults-migrate.integration.test.ts
  • test/integration/test/psl-infer/convenience-types-infer.integration.test.ts
  • test/integration/test/psl-infer/marked-types-round-trip.integration.test.ts
  • test/integration/test/psl-print/date-time-types-print.integration.test.ts
  • test/integration/test/psl-print/generated-values-roundtrip.integration.test.ts
  • test/integration/test/psl-print/prisma7-convenience-types-print.integration.test.ts
  • test/integration/test/temporal-defaults/_fixture-aliases/contract.prisma
  • test/integration/test/temporal-defaults/type-aliases-parity.test.ts
  • test/integration/test/upgrade-instructions/tools-write-convenience-types/detection.test.ts
  • upgrade-instructions/pending/prisma7-now-default-on-create/app/instructions.md
  • upgrade-instructions/pending/prisma7-now-default-on-create/extension/instructions.md
  • upgrade-instructions/pending/tools-write-convenience-types/app/instructions.md
💤 Files with no reviewable changes: 2
  • packages/3-targets/postgres/1-target/test/psl-infer/inferred-psl.round-trip.test.ts
  • examples/prisma7-adoption/migrations/snapshots/cee288aa57be618663c6c6118ece25e6ae2049027a7337e8e04c1742faedfff3/contract.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.

📝 Walkthrough

PostgreSQL date/time mappings, default handling, type inference, and type printing now use updated codec and catalog rules. The changes also add type-choice call support and update Prisma 7 contract generation and examples.

Changes: Date/time contract and type rendering

Layer / File(s) Summary
Type-choice calls for inferred and printed types
packages/1-framework/1-core/framework-components/src/shared/*, packages/2-sql-family/9-family/src/core/psl-build/*, packages/3-targets/postgres/1-target/src/core/psl-build/*, packages/3-targets/postgres/1-target/src/core/psl-infer/*, packages/3-targets/postgres/1-target/src/core/psl-print/*, related tests
The framework can match constructor calls to type-choice calls and omit arguments when defaults preserve the output. Column inference and printing use matching type choices and structured named or positional arguments.
Catalog parameters and migration checks
packages/2-sql-family/1-core/contract/src/sql-data-type.ts, packages/3-targets/postgres/1-target/src/core/data-types.ts, packages/3-targets/postgres/1-target/src/core/migrations/*, related tests
SQL type resolution retains written parameters separately from normalized parameters. Catalog rendering and PostgreSQL migration checks use written or catalog-reported type parameters. Date/time types normalize omitted precision to six while preserving catalog text as written.
Date codecs and convenience type inference
packages/3-targets/mysql/1-target/src/core/codecs.ts, packages/3-targets/postgres/1-target/src/core/*, related tests, test/integration/test/psl-infer/*, test/integration/test/psl-print/*
MySQL and PostgreSQL Date codecs reject stored values with nonzero sub-millisecond digits. PostgreSQL inference and printing use date/time convenience types. When a PostgreSQL timestamp default cannot be read exactly by its codec, inference preserves the raw SQL expression.

Prisma 7 defaults and adoption

Layer / File(s) Summary
Prisma 7 default lowering and contract updates
packages/2-sql-family/2-authoring/contract-prisma7/src/*, packages/3-targets/postgres/1-target/src/core/prisma7-binding.ts, packages/2-sql-family/2-authoring/contract-prisma7/test/*, related contract snapshots
Prisma 7 now() defaults produce a database default and a codec-resolved create generator where supported. Codec-refused literal defaults can be preserved as SQL expressions. Function defaults on list fields are rejected except for dbgenerated. PostgreSQL timestamp mappings and expected contract snapshots use date codecs.
Examples, templates, and guidance
packages/1-framework/3-tooling/cli/src/commands/init/templates/code-templates.ts, examples/prisma7-adoption/*, docs/*, gotchas.md, skills/prisma-8/references/*, upgrade-instructions/pending/*, related tests
PostgreSQL starter templates and Prisma 7 adoption examples use the revised date/time mappings. Documentation and upgrade instructions describe the mapping changes, temporal aliases, now() behavior, and sub-millisecond default handling.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~60 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Prisma7Schema
  participant ContractInterpreter
  participant PostgresBinding
  participant Contract
  Prisma7Schema->>ContractInterpreter: Read default and column metadata
  ContractInterpreter->>PostgresBinding: Request SQL for a codec-refused literal
  PostgresBinding->>ContractInterpreter: Return a cast SQL literal
  ContractInterpreter->>Contract: Record default and resolved create generator
Loading
Merge Risk: ⚪ Minimal · up to dc5f8

No actionable issue is established; the PR is mergeable after normal checks.

Pre-merge checks: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Inconclusive Docstring coverage is 58.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 60 functions across 50 files. (62 skipped… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly summarizes the primary change: schema-writing tools and the Prisma 7 reader now use convenience date and time types. It is specific and related to the changeset.
Full details: Docstring Coverage

Explanation

Docstring coverage is 58.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 60 functions across 50 files. (62 skipped: 32 unsupported, 30 over the file limit.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-new Bot commented Oct 23, 2026

Copy link
Copy Markdown

Open in StackBlitz

@prisma/orm-extension-arktype-json

npm i https://pkg.pr.new/@prisma/orm-extension-arktype-json@30858

@prisma/orm-extension-middleware-cache

npm i https://pkg.pr.new/@prisma/orm-extension-middleware-cache@30858

@prisma/orm-extension-paradedb

npm i https://pkg.pr.new/@prisma/orm-extension-paradedb@30858

@prisma/orm-extension-pgvector

npm i https://pkg.pr.new/@prisma/orm-extension-pgvector@30858

@prisma/orm-extension-postgis

npm i https://pkg.pr.new/@prisma/orm-extension-postgis@30858

@prisma/orm-extension-supabase

npm i https://pkg.pr.new/@prisma/orm-extension-supabase@30858

@prisma/orm-family-mongo

npm i https://pkg.pr.new/@prisma/orm-family-mongo@30858

@prisma/orm-family-sql

npm i https://pkg.pr.new/@prisma/orm-family-sql@30858

@prisma/orm-framework

npm i https://pkg.pr.new/@prisma/orm-framework@30858

@prisma/orm-mongo

npm i https://pkg.pr.new/@prisma/orm-mongo@30858

@prisma/orm-postgres

npm i https://pkg.pr.new/@prisma/orm-postgres@30858

@prisma/orm-sqlite

npm i https://pkg.pr.new/@prisma/orm-sqlite@30858

@prisma/orm-target-mongo

npm i https://pkg.pr.new/@prisma/orm-target-mongo@30858

@prisma/orm-target-postgres

npm i https://pkg.pr.new/@prisma/orm-target-postgres@30858

@prisma/orm-target-sqlite

npm i https://pkg.pr.new/@prisma/orm-target-sqlite@30858

@prisma/orm-toolchain

npm i https://pkg.pr.new/@prisma/orm-toolchain@30858

commit: dc5f8c8

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
postgres / no-emit 271.84 KB (0%)
postgres / emit 238.34 KB (0%)
mongo / no-emit 227.62 KB (0%)
mongo / emit 183.01 KB (0%)
cf-worker / no-emit 333.9 KB (0%)
cf-worker / emit 296.85 KB (0%)

@wmadden-electric wmadden-electric changed the title TML-3713: contract infer, print, the Prisma 7 reader and orm init write the convenience date and time types TML-3713: contract infer, contract print, the Prisma 7 reader and orm init write the convenience date and time types Oct 23, 2026
wmadden-electric and others added 7 commits October 23, 2026 16:23
… into the tools

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
contract infer, contract print and the Prisma 7 reader already take the option names from the type choice table, so they now write DateTime(storage: timestamp), Time(storage: timetz) and DateTime(as: temporal, precision: 3). This updates the tests, inline snapshots, READMEs, docs, skills and upgrade instructions that spelled the old names. The negative type test that writes { value: 'string' } keeps it on purpose.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
The PostgreSQL now entry passes the column precision to timestampNow for pg/timestamptz-date@1 and pg/timestamp-date@1, as it already does for the string and time generators, and the SQL family's timestampNow rounds the Date down below that precision. A Prisma 7 @db.Timestamp(0) @updatedat field generated .700 in the client and PostgreSQL stored the next second; now both hold the second. SQLite and MongoDB pass no precision and are unchanged.

The precision is recorded beside the generator, so contracts with such a column change their execution hash; the storage hash does not change. The fixtures, the prisma7-adoption example and the Prisma 7 reader's expected contracts are re-emitted, and the upgrade instruction says to re-emit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
RUNTIME.TEMPORAL_UNAVAILABLE now says, for both a codec and a generator, that a convenience type at its default needs no Temporal: DateTime reads a JavaScript Date, and Date, Time and Duration read ISO 8601 strings. The generator's fix no longer names the string presets, and its why says a Temporal value rather than a Temporal.Instant, since plainDateTimeNow, plainDateNow and plainTimeNow raise it too. The error reference lists pg/timestamp-instant@1 among the Temporal codecs, names now() attributes as a cause, and gives the same way out.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@db.Date and @db.Time read the same ISO 8601 text as before, but @db.Timetz now reads a full offset, 10:00:00+02:00 or 10:00:00Z, where it read 10:00:00+02 and 10:00:00+00. The table says so and points to the ISO strings change for the rest instead of repeating it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
wmadden-electric merged commit 510d1a0 into tml-3712-convenience-date-time-types Oct 23, 2026
5 of 6 checks passed
@wmadden-electric
wmadden-electric deleted the tml-3713-tools-write-convenience-types branch October 23, 2026 15:08
opensource-fork-sync Bot pushed a commit to cla7aye15I4nd/opensource-prisma__orm that referenced this pull request Oct 23, 2026
…, read ISO strings on every server, and get the design for convenience types (prisma#30834)

## Linked issue

Refs TML-3709 (Linear project: Convenience date and time types). Fixes
TML-3418, TML-3711 and TML-3719, which were reviewed as
prisma#30851, prisma#30844 and prisma#30839 and
squash-merged into this branch so they reach `main` together.

## Summary

```prisma
model Event {
  id       Int                    @id
  at       TimestamptzTemporal(3) // was Timestamptz(3): timestamptz(3), read as a Temporal.Instant
  legacyAt TimestampJsDate(3)     // new: timestamp(3), read as a JavaScript Date, stored as UTC
  day      DateTemporal           // new name: date, read as a Temporal.PlainDate
  period   IntervalString         // new: interval, read as "P1Y2M"
  label    TimestamptzString      // reads "2024-01-01T00:00:00Z" on every server
}
```

**The decision: PostgreSQL's explicit date and time types become a
complete, predictable layer, and ADR 279 records how convenience types
`DateTime`, `Date`, `Time` and `Duration` will be built on top of it.**
This PR lands the design and the three changes the convenience types
need first. The convenience types themselves and the tools that write
them follow in prisma#30847 and prisma#30858.

### Why

Prisma 7 had one date type, `DateTime`, always read as a JavaScript
`Date`. That is easy to learn, but a `Date` is a moment in time, so it
is the wrong value for a calendar date: a birthday created at local
midnight east of UTC is stored as the day before.

Prisma 8 replaced it with explicit types, each naming the column type
and the value the application reads: `TimestamptzJsDate` is a
`timestamptz` read as a `Date`. Every choice is visible, but a column
type with three kinds of value has three names, and nothing says which
to start with. The research behind this project also found three defects
in the explicit layer: the string types returned text that depends on
the server's settings, `timestamp` and `interval` lacked codecs a
sensible default needs, and an adopted Prisma 7 schema stored local time
where Prisma 7 stored UTC.

### 1. The design: ADR 279

ADR 279, "Convenience types choose an explicit type from their
arguments", adds a second kind of type declaration. A convenience type
is named for what a field means, and its optional arguments `as:` (the
value the application reads) and `storage:` (the database type) pick
exactly one explicit type from a table:

```prisma
paidAt    DateTime                      // exactly TimestamptzJsDate(3)
settledAt DateTime(as: temporal)        // exactly TimestamptzTemporal
legacyAt  DateTime(storage: timestamp)  // exactly TimestampJsDate(3)
shipBy    Date                          // exactly DateString
```

The contract records only the explicit type, so nothing below PSL and
the TypeScript builder changes. Defaults need no setup: `DateTime` reads
a `Date`, and `Date`, `Time` and `Duration` read ISO 8601 strings, so no
default needs a `Temporal` polyfill. The project's spec, plan and per-PR
specs are in `projects/datetime-convenience-types/`, which is deleted
when the project closes.

### 2. Every explicit type names its kind of value (TML-3711)

Every type for a column type with more than one codec now carries a
suffix, so no explicit type looks like the neutral default and the bare
names are free for the convenience types:
- `Timestamptz` becomes `TimestamptzTemporal`, `Timestamp` becomes
`TimestampTemporal`, and `Interval` becomes `IntervalParts`;
- `DateTemporal` and `TimeTemporal` are added beside `Date` and `Time`,
which the convenience types take over in prisma#30847.

The old names are removed outright; there are no deprecated aliases
before the release candidate.

Three codecs are added: `pg/timestamp-date@1` (`TimestampJsDate`) and
`pg/timestamp-instant@1` (`TimestampInstant`) read a `timestamp` column
as UTC, and `pg/interval-string@1` (`IntervalString`) reads an interval
as an ISO 8601 duration. Prisma 7's `DateTime` is a `timestamp(3)` read
as a `Date`, so an adopted schema needs the first.

Temporal fields take their types from `temporal-spec`, a package of
declarations with no runtime code. Before, they named the global
`Temporal` type and were typed `any` in a project without a polyfill's
global declarations.

### 3. String types read ISO 8601 on every server (TML-3418)

| `TimestamptzString` holding `2024-01-01T00:00:00Z` | Before | After |
| --- | --- | --- |
| on a server in UTC | `2024-01-01 00:00:00+00` | `2024-01-01T00:00:00Z`
|
| on a server set to `Europe/Berlin` | `2024-01-01 01:00:00+01` |
`2024-01-01T00:00:00Z` |
| holding 44 BC | `0044-03-15 12:00:00+00 BC` |
`-000043-03-15T12:00:00Z` |

The string codecs return the ISO 8601 form the contract already stores
(ADR 254). Codec ids and contracts do not change. Their `now()`
generators write the same form and round down to the column's precision.

PostgreSQL prints dates in the session's `DateStyle`, so the PostgreSQL
target now declares `sessionSettings: { DateStyle: 'ISO' }`, and the
driver ensures it on every connection it hands out. A connection Prisma
opens gets it as a startup option. A `pg.Pool` or `pg.Client` the
application passes in gets `set_config` before first use and again after
a connection held for a transaction is released. If a connection still
prints another style, every date and time codec fails with
`RUNTIME.DATE_STYLE_NOT_ISO` instead of misreading the value. ADR 159
records the rule: a target declares session settings, and the driver
ensures them.

### 4. An adopted Prisma 7 schema fills `@default(now())` in UTC
(TML-3719)

Prisma 7's client filled `@default(now())` itself on create, in UTC, and
the database default covered writes from outside Prisma. The Prisma 7
schema reader kept only the database default, so on a server whose
`TimeZone` is not UTC every row Prisma 8 created stored local time. The
reader now reads `@default(now())` as `@default(now())
@onCreate(now())`. The storage hash is unchanged; the execution hash
changes, so adopted projects re-emit. The reader also refuses two
schemas Prisma 7 refuses: `now()` on a field that is not a date or time,
and a function default other than `dbgenerated` on a list field.

## Testing performed

Each part was tested and reviewed in its own PR (see the links above);
the details are there. On this branch after combining them:
- `pnpm build`, `pnpm typecheck`, `pnpm fixtures:check`, `pnpm
lint:deps`, `pnpm lint:ratchets`, `pnpm lint:docs`, `pnpm
check:upgrade-coverage --mode pr`.
- Package tests and lint for target-postgres, adapter-postgres,
driver-postgres, the codec testkit and contract-prisma7, and the date
and time integration files and journeys.

## Skill update

`skills/prisma-8/references/contract.md` and `debug.md` use the new
names, describe ISO values and the `DateStyle` error. Upgrade
instructions: `explicit-date-time-types` (`app` and `extension`), the
ISO strings instructions (`app` and `extension`), and
`prisma7-now-default-on-create` (`app`).

## Checklist

- [x] All commits are signed off.
- [x] Scoped to one logical concern: the explicit date and time layer
the convenience types are built on.
- [x] Tests are updated.
- [x] The PR title is in `TML-NNNN: <sentence-case title>` form.
- [x] The Skill update section is filled in.

## Notes for the reviewer

- The three PRs were merged here to send one entry through the merge
queue instead of four. Their diffs were approved as they were; the only
new work on this branch is the merge of the ISO strings changes with the
explicit types changes, which both changed `decodeDate` in
`date-codecs.ts`. The shared `decodeDate` keeps the `DateStyle` check,
so `TimestampJsDate` and `TimestampInstant` get it too, and
`date-style-every-codec.test.ts` checks every registered date and
timestamp codec.
- Hosted connection poolers (Supavisor, Neon, Hyperdrive, Prisma
Postgres, PgBouncer) are not tested. Where a pooler refuses or drops the
startup option, the failure is a connection error or
`RUNTIME.DATE_STYLE_NOT_ISO`, never a misread value.
- SQLite, MySQL and MongoDB convenience types are a later decision
(TML-3714), and so are convenience types for other scalars (TML-3715).

**Alternatives considered:**
- **Name every type after its application meaning, with no explicit
layer.** That reverses ADR 257 and leaves arguments as the only exact
way to state a column type.
- **One codec for `DateTime`, with the column type as a parameter.** A
codec represents exactly one data type (ADR 254).
- **Keep `Timestamptz` and `Timestamp` unsuffixed.** The explicit types
would follow two naming patterns.
- **The codecs set `DateStyle`, or the runtime sends `SET` before each
query.** A codec has no connection, and a statement per query costs a
round trip on every query.
- **Parse every `DateStyle`.** The `SQL` and `German` styles are
ambiguous for some dates.
- **Keep only the database default for Prisma 7's `now()`.** Every
adopted project on a server not in UTC keeps a regression from Prisma 7.

Agent: sauron-95

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

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 28, 2026
…Duration, and the tools write them (prisma#30847)

## 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 prisma#30858 and
squash-merged into this branch so both reach `main` in one merge-queue
entry.

## Summary

```prisma
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
prisma#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.

```ts
// @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:

```sql
CREATE TABLE event (at timestamptz, paid_at timestamptz(3), legacy timestamp(3),
                    day date, opens time(0), local_at timetz, span interval);
```

writes:

```prisma
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

- [x] All commits are signed off.
- [x] Scoped to one logical concern: the convenience date and time
types, and the tools writing them.
- [x] Tests are updated.
- [x] The PR title is in `TML-NNNN: <sentence-case title>` form.
- [x] 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.
- prisma#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](https://claude.com/claude-code)

---------

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
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants