-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build(deps): update dependency drizzle-kit to ^0.30.0 #329
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
29175eb
to
c3c4b90
Compare
c3c4b90
to
4b4ba8b
Compare
4b4ba8b
to
454f578
Compare
454f578
to
0f0ff5a
Compare
0f0ff5a
to
1e4c1e3
Compare
1e4c1e3
to
301806f
Compare
301806f
to
e1ac1f1
Compare
e1ac1f1
to
0d0de65
Compare
0d0de65
to
f330a91
Compare
f330a91
to
9edd567
Compare
9edd567
to
8b8053d
Compare
8b8053d
to
e08190a
Compare
d24120f
to
eb3bbd9
Compare
eb3bbd9
to
608f487
Compare
608f487
to
f2802f3
Compare
f2802f3
to
0031355
Compare
0031355
to
cb0d35d
Compare
cb0d35d
to
28f5363
Compare
28f5363
to
ca5fb4e
Compare
ca5fb4e
to
4131396
Compare
4131396
to
8a2dbf0
Compare
8a2dbf0
to
8f9f0fc
Compare
8f9f0fc
to
9bca0c4
Compare
9bca0c4
to
38af64c
Compare
38af64c
to
7fe5c8f
Compare
This PR contains the following updates:
^0.24.0
->^0.30.0
Release Notes
drizzle-team/drizzle-orm (drizzle-kit)
v0.30.0
Compare Source
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 selectedmode
. 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, allpostgres.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
.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
Bug fixed in this release
Big thanks to @Angelelz!
v0.29.1
Compare Source
Fixes
New Features/Helpers
🎉 Detailed JSDoc for all query builders in all dialects - thanks @realmikesolo
You can now access more information, hints, documentation links, etc. while developing and using JSDoc right in your IDE. Previously, we had them only for filter expressions, but now you can see them for all parts of the Drizzle query builder
🎉 New helpers for aggregate functions in SQL - thanks @L-Mario564
Here is a list of functions and equivalent using
sql
templatecount
countDistinct
avg
avgDistinct
sum
sumDistinct
max
min
New Packages
🎉 ESLint Drizzle Plugin
For cases where it's impossible to perform type checks for specific scenarios, or where it's possible but error messages would be challenging to understand, we've decided to create an ESLint package with recommended rules. This package aims to assist developers in handling crucial scenarios during development
Install
You can install those packages for typescript support in your IDE
Usage
Create a
.eslintrc.yml
file, adddrizzle
to theplugins
, and specify the rules you want to use. You can find a list of all existing rules belowAll config
This plugin exports an
all
config that makes use of all rules (except for deprecated ones).At the moment,
all
is equivalent torecommended
Rules
enforce-delete-with-where: Enforce using
delete
with the.where()
clause in the.delete()
statement. Most of the time, you don't need to delete all rows in the table and require some kind ofWHERE
statements.Error Message:
Optionally, you can define a
drizzleObjectName
in the plugin options that accept astring
orstring[]
. This is useful when you have objects or classes with a delete method that's not from Drizzle. Such adelete
method will trigger the ESLint rule. To avoid that, you can define the name of the Drizzle object that you use in your codebase (like db) so that the rule would only trigger if the delete method comes from this object:Example, config 1:
Example, config 2:
enforce-update-with-where: Enforce using
update
with the.where()
clause in the.update()
statement. Most of the time, you don't need to update all rows in the table and require some kind ofWHERE
statements.Error Message:
Optionally, you can define a
drizzleObjectName
in the plugin options that accept astring
orstring[]
. This is useful when you have objects or classes with a delete method that's not from Drizzle. Such asupdate
method will trigger the ESLint rule. To avoid that, you can define the name of the Drizzle object that you use in your codebase (like db) so that the rule would only trigger if the delete method comes from this object:Example, config 1:
Example, config 2:
v0.29.0
Compare Source
New Dialects
🎉
SingleStore
dialect is now available in DrizzleThanks to the SingleStore team for creating a PR with all the necessary changes to support the MySQL-compatible part of SingleStore. You can already start using it with Drizzle. The SingleStore team will also help us iterate through updates and make more SingleStore-specific features available in Drizzle
You can check out our Getting started guides to try SingleStore!
New Drivers
🎉
SQLite Durable Objects
driver is now available in DrizzleYou can now query SQLite Durable Objects in Drizzle!
For the full example, please check our Get Started Section
v0.28.1
Compare Source
Bug fixes
v0.28.0
Compare Source
Improvements
Bug Fixes
v0.27.2
Compare Source
drizzle-orm/supabase
v0.27.1
Compare Source
v0.27.0
Compare Source
Correct behavior when installed in a monorepo (multiple Drizzle instances)
Replacing all
instanceof
statements with a customis()
function allowed us to handle multiple Drizzle packages interacting properly.It also fixes one of our biggest Discord tickets:
maximum call stack exceeded
🎉You should now use
is()
instead ofinstanceof
to check if specific objects are instances of specific Drizzle types. It might be useful if you are building something on top of the Drizzle API.distinct
clause supportAlso,
distinct on
clause is available for PostgreSQL:bigint
andboolean
support for SQLiteContributed by @MrRahulRamkumar (#558), @raducristianpopa (#411) and @meech-ward (#725)
DX improvements
where
callback in RQB for tables without relationsVarious docs improvements
v0.26.2
Compare Source
v0.26.1
Compare Source
data is malformed
for viewsv0.26.0
Compare Source
New Features
Checks support in
drizzle-kit
You can use drizzle-kit to manage your
check
constraint defined in drizzle-orm schema definitionFor example current drizzle table:
will be generated into
The same is supported in all dialects
Limitations
generate
will work as expected for all check constraint changes.push
will detect only check renames and will recreate the constraint. All other changes to SQL won't be detected and will be ignored.So, if you want to change the constraint's SQL definition using only
push
, you would need to manually comment out the constraint,push
, then put it back with the new SQL definition andpush
one more time.Views support in
drizzle-kit
You can use drizzle-kit to manage your
views
defined in drizzle-orm schema definition. It will work with all existing dialects and view optionsPostgreSQL
For example current drizzle table:
will be generated into
Views supported in all dialects, but materialized views are supported only in PostgreSQL
Limitations
generate
will work as expected for all view changespush
limitations:push
, you would need to manually comment out the view,push
, then put it back with the new SQL definition andpush
one more time.Updates for PostgreSQL enums behavior
We've updated enum behavior in Drizzle with PostgreSQL:
Add value after or before in enum: With this change, Drizzle will now respect the order of values in the enum and allow adding new values after or before a specific one.
Support for dropping a value from an enum: In this case, Drizzle will attempt to alter all columns using the enum to text, then drop the existing enum and create a new one with the updated set of values. After that, all columns previously using the enum will be altered back to the new enum.
Support for dropping an enum
Support for moving enums between schemas
Support for renaming enums
v0.25.0
Compare Source
Breaking changes and migrate guide for Turso users
If you are using Turso and libsql, you will need to upgrade your
drizzle.config
and@libsql/client
package.@libsql/[email protected]
or higher if you are using themigrate
function. For other use cases, you can continue using previous versions(But the suggestion is to upgrade)To install the latest version, use the command:
drizzle.config
for SQLite and Turso users, which allowed a shared strategy for both dialects. Starting with this release, we are introducing the turso dialect in drizzle-kit. We will evolve and improve Turso as a separate dialect with its own migration strategies.Before
After
If you are using only SQLite, you can use
dialect: "sqlite"
LibSQL/Turso and Sqlite migration updates
SQLite "generate" and "push" statements updates
Starting from this release, we will no longer generate comments like this:
We will generate a set of statements, and you can decide if it's appropriate to create data-moving statements instead. Here is an example of the SQL file you'll receive now:
LibSQL/Turso "generate" and "push" statements updates
Since LibSQL supports more ALTER statements than SQLite, we can generate more statements without recreating your schema and moving all the data, which can be potentially dangerous for production environments.
LibSQL and Turso will now have a separate dialect in the Drizzle config file, meaning that we will evolve Turso and LibSQL independently from SQLite and will aim to support as many features as Turso/LibSQL offer.
With the updated LibSQL migration strategy, you will have the ability to:
You can find more information in the LibSQL documentation
LIMITATIONS
This is because LibSQL/Turso does not support dropping this type of foreign key.
If the table has indexes, altering columns will cause index recreation:
Drizzle-Kit will drop the indexes, modify the columns, and then create the indexes.
Adding or dropping composite foreign keys is not supported and will cause table recreation.
Primary key columns can not be altered and will cause table recreation.
Altering columns that are part of foreign key will cause table recreation.
NOTES
See more: https://www.sqlite.org/foreignkeys.html
New
casing
param indrizzle-orm
anddrizzle-kit
There are more improvements you can make to your schema definition. The most common way to name your variables in a database and in TypeScript code is usually
snake_case
in the database andcamelCase
in the code. For this case, in Drizzle, you can now define a naming strategy in your database to help Drizzle map column keys automatically. Let's take a table from the previous example and make it work with the new casing API in DrizzleTable can now become:
As you can see,
inStock
doesn't have a database name alias, but by defining the casing configuration at the connection level, all queries will automatically map it tosnake_case
For
drizzle-kit
migrations generation you should also specifycasing
param in drizzle config, so you can be sure you casing strategy will be applied to drizzle-kit as wellConfiguration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.