Files
drizzle-team--drizzle-orm/changelogs/drizzle-orm/0.30.0.md
T
2026-07-13 12:10:05 +08:00

43 lines
2.6 KiB
Markdown

## Breaking Changes
The Postgres timestamp mapping has been changed to align all drivers with the same behavior.
❗ We've modified the `postgres.js` driver instance to always return strings for dates, and then Drizzle will provide you with either strings of mapped dates, depending on the selected `mode`. The only issue you may encounter is that once you provide the `postgres.js`` driver instance inside Drizzle, the behavior of this object will change for dates, which will always be strings.
We've made this change as a minor release, just as a warning, that:
- If you were using timestamps and were waiting for a specific response, the behavior will now be changed.
When mapping to the driver, we will always use `.toISOString` for both timestamps with timezone and without timezone.
- If you were using the `postgres.js` driver outside of Drizzle, all `postgres.js` clients passed to Drizzle will have mutated behavior for dates. All dates will be strings in the response.
Parsers that were changed for `postgres.js`.
```ts
const transparentParser = (val: any) => val;
// Override postgres.js default date parsers: https://github.com/porsager/postgres/discussions/761
for (const type of ['1184', '1082', '1083', '1114']) {
client.options.parsers[type as any] = transparentParser;
client.options.serializers[type as any] = transparentParser;
}
```
Ideally, as is the case with almost all other drivers, we should have the possibility to mutate mappings on a per-query basis, which means that the driver client won't be mutated. We will be reaching out to the creator of the `postgres.js` library to inquire about the possibility of specifying per-query mapping interceptors and making this flow even better for all users.
If we've overlooked this capability and it is already available with `postgres.js``, please ping us in our Discord!
A few more references for timestamps without and with timezones can be found in our [docs](http://orm.drizzle.team/docs/column-types/pg#timestamp)
## Bug fixed in this release
- [BUG]: timestamp with mode string is returned as Date object instead of string - #806
- [BUG]: Dates are always dates #971
- [BUG]: Inconsistencies when working with timestamps and corresponding datetime objects in javascript. #1176
- [BUG]: timestamp columns showing string type, however actually returning a Date object. #1185
- [BUG]: Wrong data type for postgres date colum #1407
- [BUG]: invalid timestamp conversion when using PostgreSQL with TimeZone set to UTC #1587
- [BUG]: Postgres insert into timestamp with time zone removes milliseconds #1061
- [BUG]: update timestamp field (using AWS Data API) #1164
- [BUG]: Invalid date from relational queries #895