chore(deps): update dependency drizzle-kit to ^0.26.0 #27
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.19.13
->^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/client@0.10.0
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 wellv0.24.2
Compare Source
New Features
🎉 Support for
pglite
driverYou can now use pglite with all drizzle-kit commands, including Drizzle Studio!
Bug fixes
v0.24.1
Compare Source
Bug fixes
What was fixed
introspect
command.::<type>
was included in the introspected output.preserve
casing option was brokenTickets that were closed
v0.24.0
Compare Source
mysql2
(sponsored by @rizen ❤). Read more in the docs.prepare()
in MySQL no longer requires a name argumentv0.23.2
Compare Source
schemaFilter
object was passed. It was detecting enums even in schemas that were not defined in the schemaFilter.drizzle-kit up
command to work as expected, starting from the sequences release.v0.23.1
Compare Source
InferModel
fromdrizzle-orm
v0.23.0
Compare Source
🎉 Added Knex and Kysely adapters! They allow you to manage the schemas and migrations with Drizzle and query the data with your favorite query builder. See documentation for more details:
🎉 Added "type maps" to all entities. You can access them via the special
_
property. For example:Full documentation on the type maps is coming soon.
🎉 Added
.$type()
method to all column builders to allow overriding the data type. It also replaces the optional generics on columns.❗ Changed syntax for text-based enum columns:
🎉 Allowed passing an array of values into
.insert().values()
directly without spreading:The spread syntax is now deprecated and will be removed in one of the next releases.
🎉 Added "table creators" to allow for table name customization:
🎉 Implemented support for selecting/joining raw SQL expressions:
🐛 Fixed a lot of bugs from user feedback on GitHub and Discord (thank you! ❤). Fixes #293 #301 #276 #269 #253 #311 #312
v0.22.8
Compare Source
v0.22.7
Compare Source
v0.22.6
Compare Source
v0.22.5
Compare Source
v0.22.4
Compare Source
v0.22.3
Compare Source
v0.22.2
Compare Source
v0.22.1
Compare Source
v0.22.0
Compare Source
🎉 Introduced a standalone query builder that can be used without a DB connection:
🎉 Improved
WITH ... SELECT
subquery creation syntax to more resemble SQL:Before:
After:
v0.21.4
Compare Source
v0.21.3
Compare Source
v0.21.2
Compare Source
v0.21.1
Compare Source
🎉 Added support for
HAVING
clause🎉 Added support for referencing selected fields in
.where()
,.having()
,.groupBy()
and.orderBy()
using an optional callback:v0.21.0
Compare Source
Drizzle ORM 0.21.0 was released 🎉
onUpdateNow()
expression generation for default migration statementSupport for PostgreSQL array types
drizzle kit will generate
Added composite primary key support to PostgreSQL and MySQL
PostgreSQL
MySQL
Drizzle Kit 0.17.0 was released 🎉
Breaking changes
Folder structure was migrated to newer version
Before running any new migrations
drizzle-kit
will ask you to upgrade in a first placeMigration file structure < 0.17.0
Migration file structure >= 0.17.0
Upgrading to 0.17.0
To easily migrate from previous folder structure to new you need to run
up
command in drizzle kit. It's a great helper to upgrade your migrations to new format on each drizzle kit major updateNew Features
New
drizzle-kit
command calleddrop
In a case you think some of migrations were generated in a wrong way or you have made migration simultaneously with other developers you can easily rollback it by running simple command
This command will show you a list of all migrations you have and you'll need just to choose migration you want to drop. After that
drizzle-kit
will do all the hard work on deleting migration filesNew
drizzle-kit
option--breakpoints
forgenerate
andintrospect
commandsIf particular driver doesn't support running multiple quries in 1 execution you can use
--breakpoints
.drizzle-kit
will generate current sqlUsing it
drizzle-orm
will split all sql files by statements and execute them separatelyAdd
drizzle-kit introspect
for MySQL dialectYou can introspect your mysql database using
introspect:mysql
commandSupport for glob patterns for schema path
Usage example in
cli
Usage example in
drizzle.config
Bug Fixes and improvements
Postgres dialect
GitHub issue fixes
Introspect improvements
cidr
,inet
,macaddr
,macaddr8
,smallserial
minute to second
,day to hour
, etc.numerics
enums
MySQL dialect
Migration generation improvements
autoincrement
create, delete and update handlingon update current_timestamp
handling for timestampsmodify
not null
changing, usingmodify
default
drop and create statementsdefaults
generation bugs, such as escaping, date strings, expressions, etcIntrospect improvements
autoincrement
to all supported typesfsp
for time based data typesdouble
{ mode: "string" }
by defaultjson
,decimal
andbinary
datatypesenum
data type generationv0.20.18
Compare Source
v0.20.17
Compare Source
v0.20.16
Compare Source
v0.20.15
Compare Source
v0.20.14
Compare Source
v0.20.13
Compare Source
v0.20.12
Compare Source
v0.20.11
Compare Source
v0.20.10
Compare Source
v0.20.9
Compare Source
v0.20.8
Compare Source
v0.20.7
Compare Source
v0.20.6
Compare Source
v0.20.5
Compare Source
v0.20.4
Compare Source
v0.20.3
Compare Source
🎉 Added support for locking clauses in SELECT (
SELECT ... FOR UPDATE
):PostgreSQL
MySQL
🎉🐛 Custom column types now support returning
SQL
fromtoDriver()
method in addition to thedriverData
type from generic.v0.20.2
Compare Source
inet
cidr
macaddr
macaddr8
v0.20.1
Compare Source
{ logger: true }
shorthand todrizzle()
to enable query logging. See logging docs for detailed logging configuration.v0.20.0
Compare Source
🎉 Implemented support for WITH clause (docs). Example usage:
🐛 Fixed various bugs with selecting/joining of subqueries.
❗ Renamed
.subquery('alias')
to.as('alias')
.❗
sql`query`.as<type>()
is nowsql<type>`query`()
. Old syntax is still supported, but is deprecated and will be removed in one of the next releases.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.