Update dependency drizzle-kit to ^0.28.0 #114
Open
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.25.0
->^0.28.0
Release Notes
drizzle-team/drizzle-orm (drizzle-kit)
v0.28.0
Compare Source
Breaking changes
Removed support for filtering by nested relations
Current example won't work in
0.28.0
:The
table
object in thewhere
callback won't have fields fromwith
andextras
. We removed them to be able to build more efficient relational queries, which improved row reads and performance.If you have used those fields in the
where
callback before, there are several workarounds:Added Relational Queries
mode
config formysql2
driverDrizzle relational queries always generate exactly one SQL statement to run on the database and it has certain caveats. To have best in class support for every database out there we've introduced modes.
Drizzle relational queries use lateral joins of subqueries under the hood and for now PlanetScale does not support them.
When using
mysql2
driver with regular MySQL database - you should specify mode: "default".When using
mysql2
driver with PlanetScale - you need to specify mode: "planetscale".Improved IntelliSense performance for large schemas
We've run the diagnostics on a database schema with 85 tables, 666 columns, 26 enums, 172 indexes and 133 foreign keys. We've optimized internal types which resulted in 430% speed up in IntelliSense.
Improved Relational Queries Permormance and Read Usage
In this release we've fully changed a way query is generated for Relational Queri API.
As a summary we've made current set of changes in query generation startegy:
Lateral Joins: In the new version we're utilizing lateral joins, denoted by the "LEFT JOIN LATERAL" clauses, to retrieve specific data from related tables efficiently For MySQL in PlanetScale and SQLite, we've used simple subquery selects, which improved a query plan and overall performance
Selective Data Retrieval: In the new version we're retrieving only the necessary data from tables. This targeted data retrieval reduces the amount of unnecessary information fetched, resulting in a smaller dataset to process and faster execution.
Reduced Aggregations: In the new version we've reduced the number of aggregation functions (e.g., COUNT, json_agg). By using json_build_array directly within the lateral joins, drizzle is aggregating the data in a more streamlined manner, leading to improved query performance.
Simplified Grouping: In the new version the GROUP BY clause is removed, as the lateral joins and subqueries already handle data aggregation more efficiently.
For this drizzle query
Query that Drizzle generates now
Query generated before:
Possibility to insert rows with default values for all columns
You can now provide an empty object or an array of empty objects, and Drizzle will insert all defaults into the database.
v0.27.2
Compare Source
🎉 Added support for
UNIQUE
constraints in PostgreSQL, MySQL, SQLiteFor PostgreSQL, unique constraints can be defined at the column level for single-column constraints, and in the third parameter for multi-column constraints. In both cases, it will be possible to define a custom name for the constraint. Additionally, PostgreSQL will receive the
NULLS NOT DISTINCT
option to restrict having more than one NULL value in a table. ReferenceExamples that just shows a different
unique
usage. Please don't search a real usage for those tablesFor MySQL, everything will be the same except for the
NULLS NOT DISTINCT
option. It appears that MySQL does not support itExamples that just shows a different
unique
usage. Please don't search a real usage for those tablesIn SQLite unique constraints are the same as unique indexes. As long as you can specify a name for the unique index in SQLite - we will treat all unique constraints as unique indexes in internal implementation
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
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.