Drizzle Team

DT

Drizzle Team

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

Join

Expo app + drizzle-kit migrations and enabling journal_mode = WAL

Hey, I'm pretty new to SQLite and drizzle-kit. I've read that enabling WAL journal mode on your SQLite DB is preferred for performance. I thought it made sense to create a custom migration npx drizzle-kit generate --custom with this statement in it: PRAGMA journal_mode = WAL; but when I deploy to my device (Android phone) the migration fails to run. Is this not the way I should be doing it?...

No config path provided, using default 'drizzle.config.ts

also tried deleting node-module then runing npm i drizzle-orm @Neondatabase/serverless ... still said it needs to be updated if i run drizzle-kit studio
No description

drizzle-kit picks wrong version in monorepo (pnpm)

Hello I have a monorepo with pnpm where I have two apps. One nextjs app and one Payload CMS app. Payload lags behind on drizzle-orm version but I want to update it for my nextjs app. I have installed different version in each project, but running drizzle-kit generate in the nextjs app complains about a too old drizzle-orm version (the one from the payload app)...
Solution:
I had to use node-linker=hoisted in .npmrc

How to connect the relationships between user, roles and permissions?

I try to figure out how to create a tables (user, role and permissions) with relationships and make the an example how to use them. ``` const users = pgTable("users", { id: serial("id").primaryKey(),...

Generate drizzle model from database

I have a postgres database and I am wondering if there is a way to generate the typescript table declarations from the database. I didn't find anything in the drizzlekit docs about this....

Single database for multiple unrelated projects concern

alright i've configured pgTableCreator and table creator filter, and it works. but it still concerns me that there is error message that its attempting to delete unrelated project tables when i do db push, is that normal TheoTut_ is my current project, RJ_ is unrelated from diff project...
No description

Unexpected Error When Using Drizzle Studio

I am using Drizzle Studio and whenever I click on the button to further display the relation of my entity to the other table, I got Unexpected error happened 😕. This only happened recently. ``` eY@https://local.drizzle.studio/index.js:48:18191 ssl@https://local.drizzle.studio/index.js:48:21923...
No description

Error: Cannot access 'interactionsRelations' before initialization

My setup is as follows: ```typescript // /lib/db/relations.ts export * from "~/lib/api/users/users.relations.schema"; export * from "~/lib/api/posts/posts.relations.schema";...

Error when trying to push to supabase

I just set up a new supabase project and was trying to set up some schema, but I found I can't push more than once. The first push works fine, after that I keep getting this error on drizzle-kit push: ``` [⢿] Pulling schema from database... /Users/myuser/test-project/node_modules/drizzle-kit/bin.cjs:19334...

migration best practice

Hi, I'm wondering how to add a column with a notNull() restriction in a table that already contains records, I mean the records present before adding this column will automatically not respect the notnull restriction which will generate errors during migration, is there a good way to handle this case?

Minified React error #310

Got this error with attached context, please let me know if I'm missing or broke something 😬

Drizzle Kit Studio is extremely slow to load with planetscale/mysql2

Drizzle Kit takes about 1-2 minutes to even load with planetscale/mysql2. Didn't have this issue until we switched from turso/sqlite...

PostgresError: foreign key constraint "product_categories_category_id_fk" cannot be implemented

Hello Drizzle users, I'm working on ecommerce store with Next.js, Drizzle ORM and Neon PostgreSQL. I was working on my schema and ran into this problem. Here's some relevant code: ```ts export const category = pgTable('category', {...

how to reinstall

Hello ... idont know how to reinstall / uninstall ... what is the command for that ... i checked the documentation only install is there

Only run some queries if conditions changed.

I have these two queries that run one after another const facilitiesQuery = baseQuery.where(and(...conditions)); const dynamicQuery = facilitiesQuery.$dynamic(); const data = await withPagination(dynamicQuery, page, limit);...

Generated Columns not working

Is support for Generated Columns still experimental or something?

Returned type inference when using tanstack query

I have a hook ```ts type GetSetGroupsArgs = Parameters<typeof db.query.setGroup.findMany>[0]; export const useSetGroups = (args?: GetSetGroupsArgs) => { return useQuery({...

Relations not working when clicked in Drizzle Studio - React Minified Error #310

The minified error translates to: "Rendered more hooks than during the previous render." I updated drizzle kit and orm to the latest versions already. I double checked my schema, and the last thing I did was add some foreign keys and another table. But those didn't give the usual errors like I would expect to see immediately after adding. The minified error doesn't go away when removing my new code. So, I think it must some issue with drizzle kit? I have no clue and there is no useful error nor lead I can follow. I would appreciate help. Thanks!...

How do you define two tables that have foreign keys to each other? drizzle-kit introspect fails

Drizzle-kit now generates a schema file with type errors - it was previously working prior to 0.24.0. In addition, the generated foreign key entry for multicolumn foreign keys has the columns in the incorrect order. (code below due to length limit)...