Update dependency drizzle-kit to ^0.31.0 #173
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.31.0Release Notes
drizzle-team/drizzle-orm (drizzle-kit)
v0.31.5Compare Source
v0.31.4Compare Source
halfvec,bitandsparsevectype generation bug in drizzle-kitv0.31.3Compare Source
databaseNameandpackageNameproperties for Studiov0.31.2Compare Source
Bug fixes
v0.31.1Compare Source
Fixed
drizzle-kit pullbugs when using Gel extensions.Because Gel extensions create schema names containing
::(for example,ext::auth), Drizzle previously handled these names incorrectly. Starting with this release, you can use Gel extensions without any problems. Here’s what you should do:drizzle.config.tsRun
drizzle-kit pullDone!
v0.31.0Compare Source
Features and improvements
Enum DDL improvements
For situations where you drop an
enumvalue or reorder values in anenum, there is no native way to do this in PostgreSQL. To handle these cases,drizzle-kitused to:However, there were a few scenarios that weren’t covered:
PostgreSQLwasn’t updating default expressions for columns when their data types changedTherefore, for cases where you either change a column’s data type from an
enumto some other type, drop anenumvalue, or reorderenumvalues, we now do the following:esbuildversion upgradeFor
drizzle-kitwe upgraded the version to latest (0.25.2), thanks @paulmarsicloudBug fixes
v0.30.6Compare Source
Bug fixes
v0.30.5Compare Source
New Features
Added
Geldialect support andgel-jsclient supportDrizzle is getting a new
Geldialect with its own types and Gel-specific logic. In this first iteration, almost all query-building features have been copied from thePostgreSQLdialect since Gel is fully PostgreSQL-compatible. The only change in this iteration is the data types. The Gel dialect has a different set of available data types, and all mappings for these types have been designed to avoid any extra conversions on Drizzle's side. This means you will insert and select exactly the same data as supported by the Gel protocol.Drizzle + Gel integration will work only through
drizzle-kit pull. Drizzle won't supportgenerate,migrate, orpushfeatures in this case. Instead, drizzle-kit is used solely to pull the Drizzle schema from the Gel database, which can then be used in yourdrizzle-ormqueries.The Gel + Drizzle workflow:
gelCLI to manage your schema.gelCLI to generate and apply migrations to the database.On the drizzle-kit side you can now use
dialect: "gel"For a complete Get Started tutorial you can use our new guides:
v0.30.4Compare Source
v0.30.3Compare Source
SingleStore
pushandgenerateimprovementsAs SingleStore did not support certain DDL statements before this release, you might encounter an error indicating that some schema changes cannot be applied due to a database issue. Starting from this version, drizzle-kit will detect such cases and initiate table recreation with data transfer between the tables
Bug fixes
v0.30.2Compare Source
v0.30.1Compare Source
New Features
drizzle-kit exportTo make drizzle-kit integration with other migration tools, like Atlas much easier, we've prepared a new command called
export. It will translate your drizzle schema in SQL representation(DDL) statements and outputs to the consoleRunning
npx drizzle-kit exportwill output this string to console
By default, the only option for now is
--sql, so the output format will be SQL DDL statements. In the future, we will support additional output formats to accommodate more migration toolsnpx drizzle-kit export --sqlv0.30.0Compare Source
Starting from this update, the PostgreSQL dialect will align with the behavior of all other dialects. It will no longer include
IF NOT EXISTS,$DO, or similar statements, which could cause incorrect DDL statements to not fail when an object already exists in the database and should actually fail.This change marks our first step toward several major upgrades we are preparing:
v0.29.1Compare Source
v0.29.0Compare Source
New Dialects
🎉
SingleStoredialect 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 Objectsdriver 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.1Compare Source
Bug fixes
v0.28.0Compare Source
Improvements
Bug Fixes
v0.27.2Compare Source
drizzle-orm/supabasev0.27.1Compare Source
v0.27.0Compare Source
New Features
Row-Level Security (RLS)
With Drizzle, you can enable Row-Level Security (RLS) for any Postgres table, create policies with various options, and define and manage the roles those policies apply to.
Drizzle supports a raw representation of Postgres policies and roles that can be used in any way you want. This works with popular Postgres database providers such as
NeonandSupabase.In Drizzle, we have specific predefined RLS roles and functions for RLS with both database providers, but you can also define your own logic.
Enable RLS
If you just want to enable RLS on a table without adding policies, you can use
.enableRLS()As mentioned in the PostgreSQL documentation:
Roles
Currently, Drizzle supports defining roles with a few different options, as shown below. Support for more options will be added in a future release.
If a role already exists in your database, and you don’t want drizzle-kit to ‘see’ it or include it in migrations, you can mark the role as existing.
Policies
To fully leverage RLS, you can define policies within a Drizzle table.
Example of pgPolicy with all available properties
Link Policy to an existing table
There are situations where you need to link a policy to an existing table in your database.
The most common use case is with database providers like
NeonorSupabase, where you need to add a policyto their existing tables. In this case, you can use the
.link()APIMigrations
If you are using drizzle-kit to manage your schema and roles, there may be situations where you want to refer to roles that are not defined in your Drizzle schema. In such cases, you may want drizzle-kit to skip managing these roles without having to define each role in your drizzle schema and marking it with
.existing().In these cases, you can use
entities.rolesindrizzle.config.ts. For a complete reference, refer to the thedrizzle.config.tsdocumentation.By default,
drizzle-kitdoes not manage roles for you, so you will need to enable this feature indrizzle.config.ts.In case you need additional configuration options, let's take a look at a few more examples.
You have an
adminrole and want to exclude it from the list of manageable rolesYou have an
adminrole and want to include it in the list of manageable rolesIf you are using
Neonand want to exclude Neon-defined roles, you can use the provider optionIf you are using
Supabaseand want to exclude Supabase-defined roles, you can use the provider optionRLS on views
With Drizzle, you can also specify RLS policies on views. For this, you need to use
security_invokerin the view's WITH options. Here is a small example:Using with Neon
The Neon Team helped us implement their vision of a wrapper on top of our raw policies API. We defined a specific
/neonimport with thecrudPolicyfunction that includes predefined functions and Neon's default roles.Here's an example of how to use the
crudPolicyfunction:This policy is equivalent to:
Neonexposes predefinedauthenticatedandanaonymousroles and related functions. If you are usingNeonfor RLS, you can use these roles, which are marked as existing, and the related functions in your RLS queries.For example, you can use the
Neonpredefined roles and functions like this:Using with Supabase
We also have a
/supabaseimport with a set of predefined roles marked as existing, which you can use in your schema.This import will be extended in a future release with more functions and helpers to make using RLS and
Supabasesimpler.For example, you can use the
Supabasepredefined roles like this:The
/supabaseimport also includes predefined tables and functions that you can use in your applicationThis allows you to use it in your code, and Drizzle Kit will treat them as existing databases,
using them only as information to connect to other entities
Let's check an example of adding a policy to a table that exists in
SupabaseBug fixes
v0.26.2Compare Source
v0.26.1Compare Source
data is malformedfor viewsv0.26.0Compare Source
New Features
Checks support in
drizzle-kitYou can use drizzle-kit to manage your
checkconstraint defined in drizzle-orm schema definitionFor example current drizzle table:
will be generated into
The same is supported in all dialects
Limitations
generatewill work as expected for all check constraint changes.pushwill 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 andpushone more time.Views support in
drizzle-kitYou can use drizzle-kit to manage your
viewsdefined 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
generatewill work as expected for all view changespushlimitations:push, you would need to manually comment out the view,push, then put it back with the new SQL definition andpushone 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.