fix(deps): update dependency drizzle-kit to ^0.29.0 #300
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
^0.28.1
->^0.29.0
Release Notes
drizzle-team/drizzle-orm (drizzle-kit)
v0.29.0
Compare Source
New Features
🎉 MySQL
unsigned
option for bigintYou can now specify
bigint unsigned
typeRead more in docs
🎉 Improved query builder types
Starting from
0.29.0
by default, as all the query builders in Drizzle try to conform to SQL as much as possible, you can only invoke most of the methods once. For example, in a SELECT statement there might only be one WHERE clause, so you can only invoke .where() once:This behavior is useful for conventional query building, i.e. when you create the whole query at once. However, it becomes a problem when you want to build a query dynamically, i.e. if you have a shared function that takes a query builder and enhances it. To solve this problem, Drizzle provides a special 'dynamic' mode for query builders, which removes the restriction of invoking methods only once. To enable it, you need to call .$dynamic() on a query builder.
Let's see how it works by implementing a simple withPagination function that adds LIMIT and OFFSET clauses to a query based on the provided page number and an optional page size:
Note that the withPagination function is generic, which allows you to modify the result type of the query builder inside it, for example by adding a join:
Read more in docs
🎉 Possibility to specify name for primary keys and foreign keys
There is an issue when constraint names exceed the 64-character limit of the database. This causes the database engine to truncate the name, potentially leading to issues. Starting from
0.29.0
, you have the option to specify custom names for bothprimaryKey()
andforeignKey()
. We have also deprecated the oldprimaryKey()
syntax, which can still be used but will be removed in future releasesRead more in docs
🎉 Read Replicas Support
You can now use the Drizzle
withReplica
function to specify different database connections for read replicas and the main instance for write operations. By default,withReplicas
will use a random read replica for read operations and the main instance for all other data modification operations. You can also specify custom logic for choosing which read replica connection to use. You have the freedom to make any weighted, custom decision for that. Here are some usage examples:Implementation example of custom logic for selecting read replicas, where the first replica has a 70% chance of being chosen, and the second replica has a 30% chance of being chosen. Note that you can implement any type of random selection for read replicas
withReplicas
function is available for all dialects in Drizzle ORMRead more in docs
🎉 Set operators support (UNION, UNION ALL, INTERSECT, INTERSECT ALL, EXCEPT, EXCEPT ALL)
Huge thanks to @Angelelz for the significant contribution he made, from API discussions to proper type checks and runtime logic, along with an extensive set of tests. This greatly assisted us in delivering this feature in this release
Usage examples:
All set operators can be used in a two ways:
import approach
orbuilder approach
Import approach
Builder approach
Read more in docs
🎉 New MySQL Proxy Driver
A new driver has been released, allowing you to create your own implementation for an HTTP driver using a MySQL database. You can find usage examples in the
./examples/mysql-proxy
folderYou need to implement two endpoints on your server that will be used for queries and migrations(Migrate endpoint is optional and only if you want to use drizzle migrations). Both the server and driver implementation are up to you, so you are not restricted in any way. You can add custom mappings, logging, and much more
You can find both server and driver implementation examples in the
./examples/mysql-proxy
folder🎉 New PostgreSQL Proxy Driver
Same as MySQL you can now implement your own http driver for PostgreSQL database. You can find usage examples in the
./examples/pg-proxy
folderYou need to implement two endpoints on your server that will be used for queries and migrations (Migrate endpoint is optional and only if you want to use drizzle migrations). Both the server and driver implementation are up to you, so you are not restricted in any way. You can add custom mappings, logging, and much more
You can find both server and driver implementation examples in the
./examples/pg-proxy
folder🎉
D1
Batch API supportReference: https://developers.cloudflare.com/d1/platform/client-api/#dbbatch
Batch API usage example:
Type for
batchResponse
in this example would be:All possible builders that can be used inside
db.batch
:More usage examples here: integration-tests/tests/d1-batch.test.ts and in docs
Drizzle Kit 0.20.0
defineConfig
functionbigint unsigned
supportprimaryKeys
andforeignKeys
now can have custom namesYou can read more about drizzle-kit updates here
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, 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.