JavaScriptTypeScriptSQL Prisma Database DesignCode MigrationBackend DevelopmentBackend Engineering 2 min read

Prisma ORM 8.0.0-rc.22 Introduces Changes to Postgres Types and MongoDB API

Prisma ORM 8.0.0-rc.22 updates PostgreSQL date handling and value object storage while refining the MongoDB execution context and contract requirements.

Prisma ORM 8.0.0-rc.22 was published on October 30, introducing breaking changes to PostgreSQL date and time types, value objects, and the MongoDB API alongside upgrade recipes for applications and extension authors.

On PostgreSQL, DateTime, Date, and Time are now convenience types alongside a new Duration type. By default, DateTime maps to timestamptz(3) read as a JavaScript Date, while Date and Time read strings like "2024-02-29" and "09:30:00". Projects retaining the previous Temporal behavior must rename types to TimestamptzTemporal, DateTemporal, and TimeTemporal, or use TypeScript equivalents like type.TimestamptzTemporal(...). The contract infer and contract print commands write these convenience types, and re-inferring a timestamptz column drops microseconds while yielding a Date instead of an ISO 8601 string unless as: string is added. A fix for the now generator on PostgreSQL timestamp columns read as a Date or Temporal value now rounds down to the column's precision.

Value objects now reside in the storage plane under storage.namespaces.<ns>.entries.valueObject, meaning changes alter the storage hash and require a migration. On managed Postgres tables, the contract derives checks for value object and discriminator columns, causing db migrate to fail on non-compliant rows, while contracts keeping value objects in the domain plane fail with CONTRACT.VALIDATION_FAILED. Postgres contracts can now declare required extensions using extension pg_trgm {} in PSL or extension('pg_trgm') in TypeScript.

MongoDB queries, raw lanes, ORM, and runtime now accept an execution context from mongoStatic({ contract }) or mongo({ contract }) instead of a contract.