drizzle-orm

drizzle-orm breaking-changes badge

drizzle-orm (latest known version: 1.0.0) has 6 known breaking changes on record, each backed by a source URL.

Actively maintainedLatest known version: 1.0.0npm ↗

Security advisories

GHSA-gpj5-g38j-94v9HIGH<0.45.2 || >=1.0.0-beta.2 <1.0.0-beta.20

Drizzle ORM has SQL injection via improperly escaped SQL identifiers

source ↗

Recent changes

v1.0.0-beta.12Breaking

- .generatedAlwaysAs() know only accepts **sql\``** and **() => sql\``**

source ↗

v1.0.0-rc.4Breaking

Version 1.0.0-rc.4 is a semver-major release over 0.45.2, but no breaking change was detected in the release notes text - flagged for manual review.

source ↗

v0.38.0Breaking

A few internal types were changed and extra generic types for length of column types were added in this release. It won't affect anyone, unless you are using those internal types for some custom wrappers, logic, etc. Here is a list of all types that were changed, so if you are relying on those, please review them before upgrading - `MySqlCharBuilderInitial` - `MySqlVarCharBuilderInitial` - `PgCharBuilderInitial` - `PgArrayBuilder` - `PgArray` - `PgVarcharBuilderInitial` - `PgBinaryVectorBuilderInitial` - `PgBinaryVectorBuilder` - `PgBinaryVector` - `PgHalfVectorBuilderInitial` - `PgHalfVectorBuilder` - `PgHalfVector` - `PgVectorBuilderInitial` - `PgVectorBuilder` - `PgVector` - `SQLiteTextBuilderInitial`

source ↗

v0.33.0Breaking

- [[BUG]: jsonb always inserted as a json string when using postgres-js](https://github.com/drizzle-team/drizzle-orm/issues/724) - [[BUG]: jsonb type on postgres implement incorrectly](https://github.com/drizzle-team/drizzle-orm/issues/1511) > As we are doing with other drivers, we've changed the behavior of PostgreSQL-JS to pass raw JSON values, the same as you see them in the database. So if you are using the PostgreSQL-JS driver and passing data to Drizzle elsewhere, please check the new behavior of the client after it is passed to Drizzle. > We will update it to ensure it does not override driver behaviors, but this will be done as a complex task for everything in Drizzle in other releases If you were using `postgres-js` with `jsonb` fields, you might have seen stringified objects in your database, while drizzle insert and select operations were working as expected. You need to convert those fields from strings to actual JSON objects. To do this, you can use the following query to update your database: **if you are using jsonb:** ```sql update table_name set jsonb_column = (jsonb_column #>> '{}')::jsonb; ``` **if you are using json:** ```sql update table_name set json_column = (json_column #>> '{}')::json; ``` We've tested it in several cases, and it worked well, but only if all stringified objects are arrays or objects. If you have primitives like strings, numbers, booleans, etc., you can use this query to update all the fields **if you are using jsonb:** ```sql UPDATE table_name SET jsonb_column = CASE -- Convert to JSONB if it is a valid JSON object or array WHEN jsonb_column #>> '{}' LIKE '{%' OR jsonb_column #>> '{}' LIKE '[%' THEN (jsonb_column #>> '{}')::jsonb ELSE jsonb_column END WHERE jsonb_column IS NOT NULL; ``` **if you are using json:** ```sql UPDATE table_name SET json_column = CASE -- Convert to JSON if it is a valid JSON object or array WHEN json_column #>> '{}' LIKE '{%' OR json_column #>> '{}' LIKE '[%' THEN (json_column #>> '{}')::json ELSE json_column END WHERE json_column IS NOT NULL; ``` If nothing works for you and you are blocked, please reach out to me @AndriiSherman. I will try to help you!

source ↗

v0.31.0Breaking

> Note: `drizzle-orm@0.31.0` can be used with `drizzle-kit@0.22.0` or higher. The same applies to Drizzle Kit. If you run a Drizzle Kit command, it will check and prompt you for an upgrade (if needed). You can check for Drizzle Kit updates. [below](#drizzle-kit-updates-drizzle-kit0220)

source ↗

v0.30.0Breaking

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)

source ↗

Check what changed for drizzle-orm since your installed version, live.

Open the playground →