-
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.26.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
This PR contains the following updates:
^0.24.0
->^0.26.0
Release Notes
drizzle-team/drizzle-orm (drizzle-kit)
v0.26.2
Compare Source
v0.26.1
Compare Source
v0.26.0
Compare Source
Drizzle ORM 0.26.0 is here 🎉
README docs are fully transferred to web
The documentation has been completely reworked and updated with additional examples and explanations. You can find it here: https://orm.drizzle.team.
Furthermore, the entire documentation has been made open source, allowing you to edit and add any information you deem important for the community.
Visit https://github.com/drizzle-team/drizzle-orm-docs to access the open-sourced documentation.
Additionally, you can create specific documentation issues in this repository
New Features
Introducing our first helper built on top of Drizzle Core API syntax: the Relational Queries! 🎉
With Drizzle RQ you can do:
where
statements, allowing you to define custom conditions beyond the predefined ones available in the Drizzle Core API.Most importantly, regardless of the size of your query, Drizzle will always generate a SINGLE optimized query.
This efficiency extends to the usage of Prepared Statements, which are fully supported within the Relational Query Builder.
For more info: Prepared Statements in Relational Query Builder
Example of setting one-to-many relations
Example of querying you database
Step 1: Provide all tables and relations to
drizzle
functionIf you have schema in multiple files
Step 2: Query your database with Relational Query Builder
Select all users
Select first users
Select all users
Get all posts with just
id
,content
and includecomments
Select all posts excluding
content
columnFor more examples you can check full docs for Relational Queries
Bug fixes
Drizzle Kit updates
New ways to define drizzle config file
You can now specify the configuration not only in the
.json
format but also in.ts
and.js
formats.TypeScript example
JavaScript example
New commands 🎉
drizzle-kit push:mysql
You can now push your MySQL schema directly to the database without the need to create and manage migration files. This feature proves to be particularly useful for rapid local development and when working with PlanetScale databases.
By pushing the MySQL schema directly to the database, you can streamline the development process and avoid the overhead of managing migration files. This allows for more efficient iteration and quick deployment of schema changes during local development.
How to setup your codebase for drizzle-kit push feature?
For this feature, you need to create a
drizzle.config.[ts|js|json]
file. We recommend using.ts
or.js
files as they allow you to easily provide the database connection information as secret variablesYou'll need to specify
schema
andconnectionString
(ordb
,port
,host
,password
, etc.) to makedrizzle-kit push:mysql
workdrizzle.config.ts
exampleRun
drizzle-kit push:mysql
If Drizzle detects any potential
data-loss
issues during a migration, it will prompt you to approve whether the data should be truncated or not in order to ensure a successful migrationApprove or reject the action that Drizzle needs to perform in order to push your schema changes to the database.
Done ✅
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.