-
-
Notifications
You must be signed in to change notification settings - Fork 135
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-orm to v0.36.4 #702
Open
renovate
wants to merge
1
commit into
main
Choose a base branch
from
renovate/drizzle-orm-0.x
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Branch automerge failureThis PR was configured for branch automerge. However, this is not possible, so it has been raised as a PR instead.
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
renovate
bot
force-pushed
the
renovate/drizzle-orm-0.x
branch
4 times, most recently
from
April 2, 2024 02:01
c7b8eeb
to
f291111
Compare
renovate
bot
changed the title
build(deps): update dependency drizzle-orm to v0.30.6
build(deps): update dependency drizzle-orm to v0.30.7
Apr 3, 2024
renovate
bot
force-pushed
the
renovate/drizzle-orm-0.x
branch
10 times, most recently
from
April 9, 2024 10:58
8127784
to
4e5e16b
Compare
renovate
bot
force-pushed
the
renovate/drizzle-orm-0.x
branch
2 times, most recently
from
April 11, 2024 10:05
e07dcc9
to
9d8a962
Compare
renovate
bot
changed the title
build(deps): update dependency drizzle-orm to v0.30.7
build(deps): update dependency drizzle-orm to v0.30.8
Apr 11, 2024
renovate
bot
force-pushed
the
renovate/drizzle-orm-0.x
branch
3 times, most recently
from
April 15, 2024 23:13
b114a1c
to
007de52
Compare
renovate
bot
force-pushed
the
renovate/drizzle-orm-0.x
branch
3 times, most recently
from
April 21, 2024 15:35
7ea8731
to
8fde36f
Compare
renovate
bot
changed the title
build(deps): update dependency drizzle-orm to v0.30.8
build(deps): update dependency drizzle-orm to v0.30.9
Apr 21, 2024
renovate
bot
force-pushed
the
renovate/drizzle-orm-0.x
branch
2 times, most recently
from
April 24, 2024 03:33
d517e8d
to
a785e83
Compare
renovate
bot
force-pushed
the
renovate/drizzle-orm-0.x
branch
2 times, most recently
from
October 18, 2024 13:07
f61579a
to
b4decb5
Compare
renovate
bot
changed the title
build(deps): update dependency drizzle-orm to v0.35.1
build(deps): update dependency drizzle-orm to v0.35.2
Oct 18, 2024
renovate
bot
force-pushed
the
renovate/drizzle-orm-0.x
branch
from
October 21, 2024 21:15
b4decb5
to
145d8ed
Compare
renovate
bot
changed the title
build(deps): update dependency drizzle-orm to v0.35.2
build(deps): update dependency drizzle-orm to v0.35.3
Oct 21, 2024
renovate
bot
force-pushed
the
renovate/drizzle-orm-0.x
branch
from
October 30, 2024 14:24
145d8ed
to
c205509
Compare
renovate
bot
changed the title
build(deps): update dependency drizzle-orm to v0.35.3
build(deps): update dependency drizzle-orm to v0.36.0
Oct 30, 2024
renovate
bot
force-pushed
the
renovate/drizzle-orm-0.x
branch
from
October 30, 2024 17:29
c205509
to
62e6ced
Compare
Deployment failed with the following error:
|
renovate
bot
force-pushed
the
renovate/drizzle-orm-0.x
branch
2 times, most recently
from
November 6, 2024 19:03
076c681
to
33e3dbd
Compare
Deployment failed with the following error:
|
renovate
bot
force-pushed
the
renovate/drizzle-orm-0.x
branch
from
November 6, 2024 23:09
33e3dbd
to
461aae6
Compare
Deployment failed with the following error:
|
renovate
bot
changed the title
build(deps): update dependency drizzle-orm to v0.36.0
build(deps): update dependency drizzle-orm to v0.36.1
Nov 6, 2024
renovate
bot
force-pushed
the
renovate/drizzle-orm-0.x
branch
from
November 14, 2024 12:25
461aae6
to
051f78f
Compare
renovate
bot
changed the title
build(deps): update dependency drizzle-orm to v0.36.1
build(deps): update dependency drizzle-orm to v0.36.2
Nov 14, 2024
renovate
bot
force-pushed
the
renovate/drizzle-orm-0.x
branch
from
November 14, 2024 15:07
051f78f
to
564a41a
Compare
Deployment failed with the following error:
|
renovate
bot
force-pushed
the
renovate/drizzle-orm-0.x
branch
from
November 15, 2024 16:03
564a41a
to
a3d2841
Compare
renovate
bot
changed the title
build(deps): update dependency drizzle-orm to v0.36.2
build(deps): update dependency drizzle-orm to v0.36.3
Nov 15, 2024
renovate
bot
force-pushed
the
renovate/drizzle-orm-0.x
branch
3 times, most recently
from
November 22, 2024 12:11
be08292
to
c55e8c3
Compare
renovate
bot
changed the title
build(deps): update dependency drizzle-orm to v0.36.3
build(deps): update dependency drizzle-orm to v0.36.4
Nov 22, 2024
renovate
bot
force-pushed
the
renovate/drizzle-orm-0.x
branch
2 times, most recently
from
November 26, 2024 06:46
8a7a896
to
33b7258
Compare
renovate
bot
force-pushed
the
renovate/drizzle-orm-0.x
branch
from
November 26, 2024 19:42
33b7258
to
0802ca0
Compare
Deployment failed with the following error:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.31.0
->0.36.4
Release Notes
drizzle-team/drizzle-orm (drizzle-orm)
v0.36.4
Compare Source
New Package:
drizzle-seed
Full Reference
The full API reference and package overview can be found in our official documentation
Basic Usage
In this example we will create 10 users with random names and ids
Options
count
By default, the
seed
function will create 10 entities.However, if you need more for your tests, you can specify this in the seed options object
seed
If you need a seed to generate a different set of values for all subsequent runs, you can define a different number
in the
seed
option. Any new number will generate a unique set of valuesThe full API reference and package overview can be found in our official documentation
Features
Added
OVERRIDING SYSTEM VALUE
api to db.insert()If you want to force you own values for
GENERATED ALWAYS AS IDENTITY
columns, you can useOVERRIDING SYSTEM VALUE
As PostgreSQL docs mentions
Added
.$withAuth()
API for Neon HTTP driverUsing this API, Drizzle will send you an auth token to authorize your query. It can be used with any query available in Drizzle by simply adding
.$withAuth()
before it. This token will be used for a specific queryExamples
Bug Fixes
v0.36.3
Compare Source
New Features
Support for
UPDATE ... FROM
in PostgreSQL and SQLiteAs the SQLite documentation mentions:
Similarly, the PostgreSQL documentation states:
Drizzle also supports this feature starting from this version
For example, current query:
Will generate this sql
You can also alias tables that are joined (in PG, you can also alias the updating table too).
Will generate this sql
In PostgreSQL, you can also return columns from the joined tables.
Will generate this sql
Support for
INSERT INTO ... SELECT
in all dialectsAs the SQLite documentation mentions:
As the PostgreSQL documentation mentions:
And as the MySQL documentation mentions:
Drizzle supports the current syntax for all dialects, and all of them share the same syntax. Let's review some common scenarios and API usage.
There are several ways to use select inside insert statements, allowing you to choose your preferred approach:
Query Builder
Callback
SQL template tag
v0.36.2
Compare Source
New Features
Bug and typo fixes
Fixed typos in repository: thanks @armandsalle, @masto, @wackbyte, @Asher-JH, @MaxLeiter
Fixed .generated behavior with non-strict tsconfig
Fix Drizzle ORM for expo-sqlite
Fixed lack of schema name on columns in sql
fix: Adjust neon http driver entity kind
Export PgIntegerBuilderInitial type
[MySQL] Correct $returningId() implementation to correctly store selected fields
v0.36.1
Compare Source
Bug Fixes
v0.36.0
Compare 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
Neon
andSupabase
.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
Neon
orSupabase
, 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.roles
indrizzle.config.ts
. For a complete reference, refer to the thedrizzle.config.ts
documentation.By default,
drizzle-kit
does 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
admin
role and want to exclude it from the list of manageable rolesYou have an
admin
role and want to include it in the list of manageable rolesIf you are using
Neon
and want to exclude Neon-defined roles, you can use the provider optionIf you are using
Supabase
and 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_invoker
in 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
/neon
import with thecrudPolicy
function that includes predefined functions and Neon's default roles.Here's an example of how to use the
crudPolicy
function:This policy is equivalent to:
Neon
exposes predefinedauthenticated
andanaonymous
roles and related functions. If you are usingNeon
for 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
Neon
predefined roles and functions like this:Using with Supabase
We also have a
/supabase
import 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
Supabase
simpler.For example, you can use the
Supabase
predefined roles like this:The
/supabase
import 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
Supabase
Bug fixes
v0.35.3
Compare Source
New LibSQL driver modules
Drizzle now has native support for all
@libsql/client
driver variations:@libsql/client
- defaults to node import, automatically changes to web if target or platform is set for bundler, e.g.esbuild --platform=browser
@libsql/client/node
node compatible module, supports :memory:, file, wss, http and turso connection protocols@libsql/client/web
module for fullstack web frameworks like next, nuxt, astro, etc.@libsql/client/http
module for http and https connection protocols@libsql/client/ws
module for ws and wss connection protocols@libsql/client/sqlite3
module for :memory: and file connection protocols@libsql/client-wasm
Separate experimental package for WASMv0.35.2
Compare Source
We've added approximately 240 tests to check the ESM and CJS builds for all the drivers we have. You can check them here
v0.35.1
Compare Source
v0.35.0
Compare Source
Important change after 0.34.0 release
Updated the init Drizzle database API
The API from version 0.34.0 turned out to be unusable and needs to be changed. You can read more about our decisions in this discussion
If you still want to use the new API introduced in 0.34.0, which can create driver clients for you under the hood, you can now do so
in order to not introduce breaking change - we will still leave support for deprecated API until V1 release.
It will degrade autocomplete performance in connection params due to
DatabaseDriver
|ConnectionParams
types collision,but that's a decent compromise against breaking changes
New Features
New .orderBy() and .limit() functions in update and delete statements SQLite and MySQL
You now have more options for the
update
anddelete
query builders in MySQL and SQLiteExample
New
drizzle.mock()
functionThere were cases where you didn't need to provide a driver to the Drizzle object, and this served as a workaround
Now you can do this using a mock function
There is no valid production use case for this, but we used it in situations where we needed to check types, etc., without making actual database calls or dealing with driver creation. If anyone was using it, please switch to using mocks now
Internal updates
Bug fixes
v0.34.1
Compare Source
/connect
modulev0.34.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
A new and easy way to start using drizzle
Current and the only way to do, is to define client yourself and pass it to drizzle
But we want to introduce you to a new API, which is a simplified method in addition to the existing one.
Most clients will have a few options to connect, starting with the easiest and most common one, and allowing you to control your client connection as needed.
Let's use
node-postgres
as an example, but the same pattern can be applied to all other clientsA few clients will have a slightly different API due to their specific behavior. Let's take a look at them:
For
aws-data-api-pg
, Drizzle will requireresourceArn
,database
, andsecretArn
, along with any other AWS Data API client types for the connection, such as credentials, region, etc.For
d1
, the CloudFlare Worker types as described in the documentation here will be required.For
vercel-postgres
, nothing is needed since Vercel automatically retrieves thePOSTGRES_URL
from the.env
file. You can check this documentation for more infoOptional names for columns and callback in drizzle table
We believe that schema definition in Drizzle is extremely powerful and aims to be as close to SQL as possible while adding more helper functions for JS runtime values.
However, there are a few areas that could be improved, which we addressed in this release. These include:
Let's look at an example with PostgreSQL (this applies to all the dialects supported by Drizzle)
Previously
The previous table definition will still be valid in the new release, but it can be replaced with this instead
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 wellNew "count" API
Before this release to count entities in a table, you would need to do this:
The new API will look like this:
This can also work as a subquery and within relational queries
Ability to execute raw strings instead of using SQL templates for raw queries
Previously, you would have needed to do this to execute a raw query with Drizzle
You can now do this as well
You can now access the driver client from Drizzle db instance
v0.33.0
Compare Source
Breaking changes (for some of postgres.js users)
Bugs fixed for this breaking change
If you were using
postgres-js
withjsonb
fields, you might have seen stringified objects in your database, while drizzle insert and select operations were working as expected.You need to convert those fields from strings to actual JSON objects. To do this, you can use the following query to update your database:
if you are using jsonb:
if you are using json:
We've tested it in several cases, and it worked well, but only if all stringified objects are arrays or objects. If you have primitives like strings, numbers, booleans, etc., you can use this query to update all the fields
if you are using jsonb:
if you are using json:
If nothing works for you and you are blocked, please reach out to me @AndriiSherman. I will try to help you!
Bug Fixes
v0.32.2
Compare Source
AnySQLiteUpdate
- thanks @veloiiv0.32.1
Compare Source
v0.32.0
Compare Source
Release notes for
[email protected]
and[email protected]
New Features
🎉 MySQL
$returningId()
functionMySQL itself doesn't have native support for
RETURNING
after usingINSERT
. There is only one way to do it forprimary keys
withautoincrement
(orserial
) types, where you can accessinsertId
andaffectedRows
fields. We've prepared an automatic way for you to handle such cases with Drizzle and automatically receive all inserted IDs as separate objectsAlso with Drizzle, you can specify a
primary key
with$default
function that will generate custom primary keys at runtime. We will also return those generated keys for you in the$returningId()
call🎉 PostgreSQL Sequences
You can now specify sequences in Postgres within any schema you need and define all the available properties
Example
🎉 PostgreSQL Identity Columns
Source: As mentioned, the
serial
type in Postgres is outdated and should be deprecated. Ideally, you should not use it.Identity columns
are the recommended way to specify sequences in your schema, which is why we are introducing theidentity columns
featureExample
You can specify all properties available for sequences in the
.generatedAlwaysAsIdentity()
function. Additionally, you can specify custom names for these sequencesPostgreSQL docs reference.
🎉 PostgreSQL Generated Columns
You can now specify generated columns on any column supported by PostgreSQL to use with generated columns
Example with generated column for
tsvector
In case you don't need to reference any columns from your table, you can use just
sql
template or astring
🎉 MySQL Generated Columns
You can now specify generated columns on any column supported by MySQL to use with generated columns
You can specify both
stored
andvirtual
options, for more info you can check MySQL docsAlso MySQL has a few limitation for such columns usage, which is described here
Drizzle Kit will also have limitations for
push
command:You can't change the generated constraint expression and type using
push
. Drizzle-kit will ignore this change. To make it work, you would need todrop the column
,push
, and thenadd a column with a new expression
. This was done due to the complex mapping from the database side, where the schema expression will be modified on the database side and, on introspection, we will get a different string. We can't be sure if you changed this expression or if it was changed and formatted by the database. As long as these are generated columns andpush
is mostly used for prototyping on a local database, it should be fast todrop
andcreate
generated columns. Since these columns aregenerated
, all the data will be restoredgenerate
should have no limitationsExample
In case you don't need to reference any columns from your table, you can use just
sql
template or astring
in.generatedAlwaysAs()
🎉 SQLite Generated Columns
You can now specify generated columns on any column supported by SQLite to use with generated columns
You can specify both
stored
andvirtual
options, for more info you can check SQLite docsAlso SQLite has a few limitation for such columns usage, which is described here
Drizzle Kit will also have limitations for
push
andgenerate
command:You can't change the generated constraint expression with the stored type in an existing table. You would need to delete this table and create it again. This is due to SQLite limitations for such actions. We will handle this case in future releases (it will involve the creation of a new table with data migration).
You can't add a
stored
generated expression to an existing column for the same reason as above. However, you can add avirtual
expression to an existing column.You can't change a
stored
generated expression in an existing column for the same reason as above. However, you can change avirtual
expression.You can't change the generated constraint type from
virtual
tostored
for the same reason as above. However, you can change fromstored
tovirtual
.New Drizzle Kit features
🎉 Migrations support for all the new orm features
PostgreSQL sequences, identity columns and generated columns for all dialects
🎉 New flag
--force
fordrizzle-kit push
You can auto-accept all data-loss statements using the push command. It's only available in CLI parameters. Make sure you always use it if you are fine with running data-loss statements on your database
🎉 New
migrations
flagprefix
You can now customize migration file prefixes to make the format suitable for your migration tools:
index
is the default type and will result in0001_name.sql
file names;supabase
andtimestamp
are equal and will result in20240627123900_name.sql
file names;unix
will result in unix seconds prefixes1719481298_name.sql
file names;none
will omit the prefix completely;Example: Supabase migrations format
v0.31.4
Compare Source
v0.31.3
Compare Source
Bug fixed
New Prisma-Drizzle extension
For more info, check docs: https://orm.drizzle.team/docs/prisma
v0.31.2
Compare Source
🎉 Added support for TiDB Cloud Serverless driver:
v0.31.1
Compare Source
New Features
Live Queries 🎉
As of
v0.31.1
Drizzle ORM now has native support for Expo SQLite Live Queries!We've implemented a native
useLiveQuery
React Hook which observes necessary database changes and automatically re-runs database queries. It works with both SQL-like and Drizzle Queries: