Drizzle Team

DT

Drizzle Team

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

Join

Can't find meta/_journal.json file

HI, Im refactoring a project to now use src folder, after putting everything into the src folder, and pre-pending ./src where necessary, i get the error Can't find meta/_journal.json file my drizzle.config file: ```ts...

Postgres 18 upgrade breaks drizzle-kit push not-null

https://www.postgresql.org/docs/current/release-18.html#RELEASE-18-CONSTRAINTS tested with pg 17 and it works I'm not sure what it is but the behavior of NOT NULL seems to be changed. drizzle-kit push tries to drop the non-null constraint on a PK/FK even if explicit .notNull()...

Drizzle not null issue

Hi guys I just wanna ask about the issue I encountered when I set field notnull(screenshot below) . Whenever I put a not null regardless if what field its still showing an error (screenshot 2) , but if I remove the notNull it works fine . Even changing the fields on the update query still has that error even though the field exists ....
No description

How to update snapshot when editing migration or making a custom migration?

I understand the snapshot files are necessary for diffing the old state of the DB with the new one specified in the drizzle schema in order to properly create the migrations. However, let's say I decide to edit the latest migration created by drizzle-kit, or I decide to make a custom migration? How can I get drizzle-kit to include these changes in a snapshot file?...

Constraint name in migration not snake case

I'm using Drizzle with postgres & the casing: 'snake_case' setting and I notice when doing a uniqueness constraint that the name in the constraint (specifically the column name legacyCompanyId) is not snake case in the generated migration. Is this a bug?
No description

Date and lte

I'm adding Drizzle to my Sveltekit / Prisma stack and I can't figure out how to query by lte() date. I used the prisma extention to convert my prisma schema to drizzle and I got this for my invoices ```ts export const Invoice = pgTable('invoice', { invoiceNum: serial('invoiceNum').notNull().primaryKey(), customerId: text('customerId').notNull(), employeeId: text('employeeId'),...

Make AnswerOverflow forum easier to browse and moderate

Hey team, I’m currently building Paladin. I noticed your forum is synced to the web with AnswerOverflow. Paladin makes forums cleaner, easier to browse, and simpler to moderate directly from the web. It’s completely free to use and can either complement your existing setup or run on its own. If you want, you can try it yourself in a few minutes, or I can spin up a demo and show you how it works, no pressure either way 😀...

How to Connect drizzle client to Cloudflare/Planetscale

Cloudflare Workers have a new direct connection to Planetscale which automatically configures Hyperdrive. Whats the best way to connect with drizzle which using Planetscale Postgres? https://blog.cloudflare.com/planetscale-postgres-workers/...

How to test query operators with Jest?

Hi everyone I’m writing some unit tests with Jest for my repository methods. For example, I have something like this: ```...

Mysql Conditional Migration statements

I'm running into an issue where migrations are sometimes applied partially and I need to re run them using conditional statements. For example ```sql...

I have some issues using drizzle as a package infering the types

Context: I have a monorepo using turbo, pnpm, honojs and drizzle. I have a server application and a package called database which exports the database client and the schemas When I import on this way: import * as schemas from '../schemas';...
No description

schemaFilter/tableFilter for drizzle-kit generate

Can I filter out schema when generating migrations? It seems to omit this setting in config when I run generate command

Too many clients, Supabase

An engineer helping me on an OSS project is running into
[Error [PostgresError]: remaining connection slots are reserved for non-replication superuser connections]
[Error [PostgresError]: remaining connection slots are reserved for non-replication superuser connections]
...

drizzle-kit push

Hey, we are using drizzle-kit push command to handle our migrations. It worked well. Until yesterday, when we ended up having multiple versions of the same code and database on my machine, my co-worker's machine, and prod (it is a single database). Yesterday night, when we went for deployment, the dev version (localhost) was working well with no problems. But, when we deployed it, we got schema errors and somehow, it feels like the entire code has been hijacked. I can think of only 2 reasons. One is drizzle-kit push and another one is, this branch has been long-running, so somehow it got corrupted. So, on the drizzle-kit part, shall i use generate and migrate from now? Or is there any other solution?...

Deploying svelte-kit app on cloudflare with drizzle & D1 - how to orchestrate migrations?

How do you orchestrate migrations with cloudflare D1 when your app builds/deploys with cloudflare?

Raw SQL string to `DrizzleSQLiteSnapshotJSON`?

I'm trying to generate migrations programmatically for SQlite using drizzle-kit/api. This is the general approach I'm using: ```ts import { generateSQLiteDrizzleJson,...

Nested relation types are inferred as any instead of proper relation types

Hello, I’m running into a blocking issue. I get the correct types for the first-level fields, but the nested relation fields are not typed. I’ve already exported both the tables and the relations, but the nested depth still falls back to any....
No description

Wipe out SQLite database

I want to wipeout on-device (mobile app) sqlite database when user logs out. Is there a way to delete all tables based on drizzle schema? Or should I just delete the sqlite file? Is it safe to do so in the app using expo and drizzle? Will drizzle just auto rerun migrations when connecting to the database again?...

Common Fields Logic For Multiple Tables

I have a set of tables inheriting the same set of columns: ``` export const base = { id: text()...

Index with functions in SQLite

Hey I need to create a complex index that requires to invoke a function...is there a way to do it with Drizzle? I've tried doing this ```ts...
Next