Answer
Yes – adding a schema attribute such as @db.Timestamptz would let Prisma store offset‑aware timestamps directly in the database instead of forcing everything to UTC.
Confirmed facts (as of Prisma 5.x)
- DateTime fields are mapped to UTC‑only column types (PostgreSQL
TIMESTAMP without time zone, MySQL DATETIME, etc.) and any offset supplied in the input is discarded.
- There is no built‑in
@db.Timestamptz attribute in the stable API.
- The preview feature
unsafeTimestamps can generate PostgreSQL TIMESTAMPTZ columns, preserving the offset.
Likely explanation of how the attribute would work
If Prisma introduced @db.Timestamptz, the schema parser would treat the field as offset‑aware. The migrate generator would emit a column of type TIMESTAMPTZ for PostgreSQL (or the native equivalent for other providers). A migration that adds or changes such a column would include an ALTER COLUMN … TYPE TIMESTAMPTZ USING … clause to preserve existing data. The generated SQL would therefore reflect the new type, and Prisma Client would pass the offset through to the driver without conversion.
Steps to test the behavior today (preview feature)
- Verify your Prisma version (
prisma -v) is 5.x or later.
- In
schema.prisma enable the preview feature: preview = ["unsafeTimestamps"] inside the generator block.
- Add a DateTime field with the attribute, e.g.
createdAt DateTime @db.Timestamptz.
- Run
prisma migrate dev --name add-offset-aware.
- Inspect the generated migration file (
prisma/migrations/…/migration.sql) – you should see TIMESTAMPTZ for PostgreSQL.
- Insert a value with an offset, e.g.
'2026-10-12T14:30:00-04:00', and query it back to confirm the offset is stored.
Backward‑compatibility considerations
To avoid breaking existing projects, the attribute (or the underlying preview flag) must be opt‑in. Projects that do not enable unsafeTimestamps or the new attribute would continue to receive UTC‑only columns, preserving their current behavior. If the feature ever graduates to stable, a major version bump would be required so that existing schemas retain their current mapping unless explicitly opted‑in.
Missing diagnostic detail: Which database provider are you using (PostgreSQL, MySQL, SQLite, etc.)? The @db.Timestamptz concept only applies to providers that support timestamp with time zone; knowing your provider determines whether the attribute would be effective.