Drizzle Team

DT

Drizzle Team

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

Join

Issue with drizzle-kit and enums

I have an issue with drizzle-kit and enums and can't find a solution. I am trying to use drizzle with Supabase. When I run npx drizzle-kit push is when I get an error if the schema contains a pgEnum. If the database is fresh and the enum doesn't exist and I run that command the error I get is this: ``` npx drizzle-kit push
No config path provided, using default 'drizzle.config.ts' Reading config file 'C:...\Documents\Dev\JS\projectName\drizzle.config.ts' Using 'pg' driver for database querying...

How auto push schema and seed data when starting NextJS using Drizzle (with Docker)

I have an NextJS 15 app using Drizzle. ANd I would like to auto push and seed the data when starting the app. But how to do it ? I dont find any info about this... Btw there is my package.json : ```json { ......

mapWith not getting called on extras

Hi ```typescript const users = await db.query.users.findMany({ limit: 5, columns: {...

clone query?

I have a somewhat unorthodox need. I'd like to create a function to help with pagination, but in order to do this with a single query as the source, I need to be able to clone a query object, because the query methods seem to mutate the original query. example: https://drizzle.run/t0x6docguitgokwue2nnwkyd ...

Should any of the drizzle folder be .gitignore'd?

Hey, I saw a couple of people ask this before, but they were a few years old so I just want to double check. I see 000x_migration_name.sql, meta/_journal.json and meta/000x_snapshot.json. I ask because I see journal is prefixed with an underscore, and also it looks like it contains timestamps of when migrations have been applied. If I run the migrations against my local db and push the code to production, I obviously don't want the production db to check the journal and think it has already applied the migration, ignoring it, but perhaps that is not what is going on there?...

how to model this query in drizzle

```sql SELECT tournaments.id, tournaments.title, tournaments.info, ...

TypeError: Cannot read properties of undefined (reading 'referencedTable')

Am getting this error since last 2 days and i literally cant figure out what is wrong there is no any error in any schema and relation defination ``` TypeError: Cannot read properties of undefined (reading 'referencedTable') at normalizeRelation (file:///Users/nirajkafle/Desktop/niraj/work-projects/appcafe/FunApps.ai/node_modules/drizzle-orm/relations.js:212:56)...

refine parameters in createInsertSchema not typed properly

Hi I'm trying to get started with the Drizzle-Zod packages. I've just created a new repo using the hono create script (as per the CJ video on Syntax) installed drizzle and zod dpendencies and copied in the example createSelectSchema from the drizzle-zod docs page. The refine parameters adding min/max to the name and bio fields are giving typescript errors saying they do not exist on ZodType<Buffer, ZodTypeDef, Buffer> when the name and bio fields should be z.string types. What am I doing wrong? here are my dependencies: "dependencies": { "drizzle-orm": "^0.39.3", "drizzle-zod": "^0.7.0", "hono": "^4.7.2",...
No description

is there any way to represent runtime values in drizzle?

example: ``` WITH numbers AS ( VALUES (1), (2), (3), (4) )...

Drizzle Runner Error

As you can see by the img attached, it give that error. The schema file is being loaded, thus, there's no db being initialised there, only the schema....
No description

Filter Empty Relations out

I got both tables as defined in my schema file: ```ts export const employeesTable = table( 'employees', { id: int().autoincrement().primaryKey(),...

Directly accessing array of many to many relationship properties through junction table

I've set up a many-to-many relationship between one or more vocabulary items on one or more cards, but I can't quite seem to figure out how to set up the relations to go through the junction table but not have it appear nested in the results. Here's the (simplified) schema: ```ts...

Use 'query' with custom schema

I was wondering how to use the query operator with a custom schema (pgSchema). Because when doing : ```tsx const quiz = await db.query.quizzes .findFirst({ where: (quiz, { eq }) => eq(quiz.id, 1),...

How to get drizzle-kit to connect to local supabase via websockets with neondatabase/serverless to

Hi, I am working on an app that I plan to deploy to Cloudflare. I read that neondatabase/serverless is the proper driver to connect a postgres database from that environment. I am migrating over from Prisma, and I want to introspect my current schema with drizzle-kit pull so I don't have to build it up myself....

How to fix TypeError: Cannot read properties of undefined (reading 'columns')?

TypeError: Cannot read properties of undefined (reading 'columns') ❯ PgDialect.buildRelationalQueryWithoutPK node_modules/src/pg-core/dialect.ts:1170:32 ❯ PgDialect.buildRelationalQueryWithoutPK node_modules/src/pg-core/dialect.ts:1294:32 ❯ QueryPromise._getQuery node_modules/src/pg-core/query-builders/query.ts:117:23 ❯ QueryPromise._toSQL node_modules/src/pg-core/query-builders/query.ts:134:22...

drizzle-kit push:sqlite no working

I have been using this command for the past year and it has worked, it also worked about 3 days ago. I have set my drizzle.config.ts file to:
driver: "turso", verbose: true, strict: true, breakpoints: true,...

is there a nice way to say getTableColumns - but without columns id and foo?

Is there an easy way to omit columns? This is what I came up with but... ```...

try to push : schema "XXX" does not exist

When I try to add a custom schema, the push command dont works : ```tsx export const quizSchema = pgSchema("quiz"); export const answerTypeEnum = quizSchema.enum("answer_type", ["single_choice", "multiple_choice", "boolean", "text", "number"]);...
Solution:
okay ive found. I had to add schemaFilter: ['public', 'quiz'], in the drizzle.config.ts file

Install latest version of drizzle-orm

I am trying to use drizzle orm with drizzle kit. I have everything configured but keep getting a message from drizzle-kit to install the latest version. ```sh ❯ pnpx drizzle-kit generate No config path provided, using default 'drizzle.config.ts'...

Count issues with libsql (Turso)

``const locations = await db.query.locationsTable.findMany({ extras(fields, { sql }) { return { groupsCount: sql<number> (SELECT COUNT(*) ...