Drizzle Team

DT

Drizzle Team

The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!

Join

Migrations are not run in order

I'm running through a problem (and I hope I'm writing in relevant channel). Context: I have an existing RDS Aurora Postgres Serverless v2 cluster & I'm able to run the migrations perfectly (as per git current head). ...

sql magic operator with dates?

We were using drizzle orm but We implemented by ourselves a "multi-update" query to update fields based on different primary keys using the CASE ... THEN postgres syntax, this forced us to use the sql magic operator. Is there a way to integrate the sql magic operator with the timestamp type or with other custom types?
sql`WHEN ${where} THEN ${value}`
sql`WHEN ${where} THEN ${value}`
...

LibSQL type errors when using `drizzle-orm/libsql` import

Hey y'all. I am just beginning my drizzle journey, and am trying to set up a query to run in an AWS Lambda base-image container. I am using this guide for getting set up with Turso as my example. If I exclude the drizzle connection syntax, it all works fine. If include it, I am seeing type errors when I run tsc src/index.ts. If I just ignore them and fire up the container, I can get my TypeScript to build, but when I try to call the function, I see errors importing the libsql client library provided by the drizzle-orm package. Any ideas what might be happening here?...
No description

For update skip locked

Is there a skip locked option given a .for('update') in the select clause in drizzle?

Schema out of sync

Somehow my DB schema and my code got out of sync. Specifically, I have an ON DELETE CASCADE clause in the code that is not set at the DB level. Is there any way to ask drizzle to sync the code and the DB schema? Trying to generate a migration does not do the trick.

Filtering out tables during introspection

I'm using Planetscale, and they automatically create _vrepl tables in my database. Is there a way to filter out tables ending in _vrepl during drizzle-kit pull?

Optionally migrate a table.

Is there a way to tag a pg table to optionally migrate it when running either generate/migrate or push commands? There's a system generated table in my existing database and I know I can pull it to get the schema structure. What I don't want to do is change anything when I run the generate/migrate or push commands. Kinda like how managed=False works in Django....

`drizzle-kit pull` v0.28.0 generating faulty schema file

Running drizzle-kit pull generates an incorrect schema file. Ex: ``` export const inviteCodes = mysqlTable("invite_codes", { id: varchar({ length: 255 }).notNull(),...

Struggling with simple subquery statement in Drizzle

Hi friends, I have a complex query like so that I've made into a subquery: ```ts const query = db .select({ ......

With Query mode, is possible filter by a related table?

Is possible using db.query to filter (where) using a related table? Example: ```js const users = await db.query.posts.findMany({...

Composite Primary Key?

In the latest versions, what would be the correct third argument of a pgTable for composite primary key? '''(t) => [ primaryKey("ContactToCompany_contactId_companyId").on( t.contactId,...

Best column type for storing a small WAV file in Postgres

I have a small audio WAV file that I'd like to store in a column. What column type is best suited for that? I'm using Neon db Postgres. Note: I'm aware that I could store it in a storage like S3, but given the file is very small, I'd like to explore storing it in Neon....

Rollback not happening on tx.rollback() [PG DRIVER]

```ts export async function createRestaurantMenuMutation({ label, type, availabilityDate,...

Drizzle studio not recognising new schemas

Hi guys When I was learning Drizzle I. Came around a problem Where I have a written a new schema After recognizing my Mistake in previous Schema, but the drizzle studio Does not recognising the new schema and always showing the the table on context of old schema? Even I have regenerated the schema and And pushed the latest migrations to my database , but still drizzle Studio Show me the schema with context to old schema...

Drizzle & Neon low latency

I have my app server deployed on railway (FRA) and a neon DB deployed in FRA as well. My latency from App -> DB (with drizzle) is about 800ms while when using the neon Console directly I have a latency of about 45ms. Where does this overhead come from?...

TypeError: client.migrate

I am getting this error TypeError: client.migrate is not a function with Kysely + Drizzle Kit + Turso + Bun + Nextjs when I drizzle-kit push. My config (in the root of nextjs project): ``` import { defineConfig } from "drizzle-kit";...

Issues Using RLS with Supabase Through Drizzle

Hi everyone, Does anyone know how to use RLS with Supabase via Drizzle? I was really excited to see that it's finally supported, but unfortunately, it’s not working for me. After migrating the table, I added .enableRLS()—this part works fine, and I can see on the Supabase dashboard that RLS is enabled for that table....
No description

SQLite insert schema does not include nullable columns?

Hi, I am just tring out Drizzle with SQLite, but am running into some weird problem. I created a table like this ```export const products = sqliteTable( "products_table", {...

[Postgres] PostgresError: type X already exists.

PostgresError: type "media_types" already exists
PostgresError: type "media_types" already exists
I have SQL like this: CREATE TYPE "public"."media_types" AS ENUM('image', 'video');--> sta ...

Drizzle-kit not working as expected

If there is a file xyz.ts and it currently has one table and if I use npx drizzle-kit push it runs sucessfully I add one more table to same file and use the command again it throws error ```ts [itsmishra@Rajat ayanami]$ npx drizzle-kit push No config path provided, using default 'drizzle.config.ts' Reading config file '/home/itsmishra/ayanami/drizzle.config.ts'...