I am evaluating Prisma and I am a complete noob...
model Sth {
id Int @default(autoincrement()) @id
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
expiresAt DateTime?
}
The createdAt column translates to
createdAt | timestamp(3) without time zone | | not null | CURRENT_TIMESTAMP
Since I am planing to really work with the timestamps - I need them to be timestamp with time zone.
How can I achieve this with Prisma?
Edit NOW() > '2021-02-16': Prisma now, has the "native types"
For those of us living in the future, it is now possible to save records with timestamp with timezone for postgresql through Prisma's 'Native database type attribute'.
https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#postgresql-6
Please note that for my database I had to set the timezone to 'UTC' so that the correct timezone is set to what I wanted by @default.
The above example with the Native database type attributes.
model Sth {
id Int @default(autoincrement()) @id
createdAt DateTime @default(now()) @db.Timestamptz(3)
updatedAt DateTime @updatedAt @db.Timestamptz(3)
expiresAt DateTime? @db.Timestamptz(3)
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With