Brendonovich / prisma-client-rust

Type-safe database access for Rust
https://prisma.brendonovich.dev
Apache License 2.0
1.76k stars 104 forks source link

should the preferred time be timestamptz? #272

Closed brecht-derooms closed 1 year ago

brecht-derooms commented 1 year ago

I recall a big change in npgsql related to timestamp vs timestamptz where they made the choice to require DateTimes with UTC timezone to be written to timestamptz columns. https://www.npgsql.org/doc/types/datetime.html

Besides that, it seems to be the preferred default according to this: https://dba.stackexchange.com/questions/265550/any-downside-to-using-timestamp-without-time-zone-if-utc-is-ok-at-all-times.

Postgres also advises storing UTC timestamps in https://wiki.postgresql.org/wiki/Don%27t_Do_This#:~:text=might%20be%20suitable.-,Don't%20use%20timestamp%20(without%20time%20zone)%20to%20store,timestamp%20with%20time%20zone%20instead.

Having experienced working with npgsql (and witnessed that change) I wondered what would be generated here. Is there any reason to favor timestamp over timestamptz columns since I assume most people would be storing UTC timestamps?

Brendonovich commented 1 year ago

This is also a question for Prisma itself, PCR is only concerned with Rust stuff.