Repository navigation
docs: the add-to-existing-project, Drizzle, SQL ORM and Prisma 7 pages drop the Temporal workarounds for inferred date columns - #8399
Closed
wmadden-electric wants to merge 1 commit into
Conversation
…he guides drop the Temporal workarounds prisma/orm#30553 (TML-3366) makes contract infer and prisma7Schema write TimestamptzString, TimestampString, DateString and TimeString, the text types orm init already scaffolds. Applications then read and write those columns with no global Temporal, so the add-to-existing-project guide no longer installs temporal-polyfill, and the Drizzle and SQL ORM guides no longer ask readers to retype every Timestamptz field by hand. The coming-from-Prisma-7 page says the same for schema.prisma read through prisma7Schema. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Comment |
Contributor
🍈 Lychee Link Check Report91 links: ✅ All links are working!Full Statistics Table
|
Contributor
Author
|
Closing in favour of #8400, the 8.0.0-rc.15 docs update, which makes the same changes to these four pages as part of the release update and is already approved. |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
At a glance
Run
prisma contract inferagainst a database with atimestamptzcolumn, with the ORM packages that include prisma/orm#30553:Before, the same command wrote
createdAt Timestamptz, and on Node.js 24 the first query that read the column failed withRUNTIME.TEMPORAL_UNAVAILABLE. The guides worked around that by installingtemporal-polyfillor by telling readers to retype every date field by hand. Those workarounds come out.What this PR changes
contract infernow writes, and its date section describes text values instead of a polyfill install.TimestamptztoTimestamptzString" edit, in the prose, the diff block, the gotchas and the agent prompt.schema.prismaread throughprisma7Schema(...)gives text date values that need noTemporal.Why the workarounds existed
Prisma ORM 8 on PostgreSQL has two families of date and time types.
Timestamptz,Timestamp,DateandTimeread and writeTemporalvalues, the new JavaScript date API.TimestamptzString,TimestampString,DateStringandTimeStringkeep the same column types and hand your code the text PostgreSQL returns. Node.js 24 and older have no globalTemporal, and the application runtime deliberately bundles no fallback, so aTemporalfield fails on its first read there.prisma orm initalways scaffolded the text types, so new projects never hit this. The two paths that adopt an existing database did not:contract infer, which every add-to-existing-project and switch-from-another-ORM guide runs, andprisma7Schema(...), the Prisma 7 upgrade path. Both wrote theTemporaltypes. The guides on this site documented the failure and told readers to installtemporal-polyfillor retype the fields.What the ORM fix changed
prisma/orm#30553 makes
contract inferandprisma7Schema(...)write the text types, the same onesorm initwrites. An application that adopts an existing database then reads and writes its date columns with noTemporalat all. Fields a reader writes by hand asTimestamptzorDateTimestill read asTemporalvalues, so the pages about hand-written contracts (data-modeling,psl-syntax, the client reference, the error reference) are unchanged, and the add-to-existing-project guide keeps a sentence on how to opt back intoTemporal.The inferred contract excerpts in the three guides are realigned to match what the tool prints, since the longer type name widens the type column.
Tests
pnpm run lint:links,pnpm run lint:spellcheckinapps/docs: pass.lint:codereports only pre-existing violations; this change removes code blocks and adds none.Alternatives considered
Temporalfield, so there is nothing to warn about on those paths. The warning stays where it still applies, on the pages about hand-written types.prisma8/contract.prismastill usesTimestamp(3), and the guide links itsstep-0tostep-3tags, so changing it means re-creating the tags. Tracked as a follow-up.Agent: arachne-39
🤖 Generated with Claude Code