Drizzle Team

DT

Drizzle Team

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

Join

I can't get the correct typing

Hello, I am new to drizzle and I am in a situation that I don't know how to solve, I would appreciate your help. In this case I have the table of “users” and “account” in this case I want to return the user with its relation which is ‘account’ but it does not return the correct typing for the “account” part. As you can see it says “never”, I don't know what the problem could be. I export correctly the table with its relations on both sides
No description

Cannot find package 'bun' imported from F:\code\RELAND\node_modules\drizzle-orm\bun-sql\driver.js

Could not get to work using bun postgres in drizzle: https://orm.drizzle.team/docs/connect-bun-sql I am using Tanstack Start with bun runtime on Vite...

How do I stop Drizzle from trying to instantiate a connection during build time (next.js)?

Hey everyone, I've a question I can't seem to solve myself right now. I'm using next.js with tRPC and Drizzle (t3 stack, https://github.com/t3-oss/create-t3-app). I'm currently setting up my Docker configuration. I did not intend to pass the env var holding the database url to my docker builder container. As a result, Drizzle is throwing an error because it is trying to instantiate a database connection as soon as createClient is invoked, even though nothing is trying to access the database. How can I work around this? With Prisma this was not an issue, because Prisma only connects to the database if you actually call $connect / upon the first query ran....

Drizzle hides DB errors, shows just "failed query"

Drizzle doesn't show anymore errors. Any way to get them back?
No description

getting a typescript error when trying to use drizzle.mock()

I'm trying to mock my drizzle driver for some unit tests. I'm using drizzle.mock(). When I pass it into the function that takes it, I get the following error: ```Argument of type NodePgDatabase<Record<string, never>> & { $client: "$client is not available on drizzle.mock()";...

How to hide notice logs because of identifier trucation?

Hi there, i am getting constant logs from drizzle/postgres like these: ```{ severity_local: 'NOTICE', severity: 'NOTICE',...

Transactions are not supported by this version of Drizzle Kit. Please update to the latest version.

what can be the cause of getting this error in SQL console? im not using any transactions and updating to latest version didnt work...

We've found duplicated view name across public schema [But there is not a duplicated view]

After I upgrade the drizzle-kit from: drizzle-kit: ^0.24.0 to drizzle-kit: ^0.31.4 When I ran the command: drizzle-kit generate ...

Is there a way to properly type a "generic query"

Is there a way to properly type a "generic query" with drizzle, rather than trying to duck-type it like this ```ts export async function paginateWithCursor< T,...

drizzle-seed and many-to-many relationship

Hello, is there a way to seed two tables linked by a join table using drizzle-seed?

local.drizzle.studo issue

It was working fine before, but suddenly it stopped. I'm on Windows. Any ideas what could be blocking Drizzle Studio or how to get more debug info?
No description

Warning '@neondatabase/serverless' can only connect to remote instance, but it works?

What is the point of this warning when the migrations are working when using @neondatabase/serverless? I was able to get rid of this warning for drizzle-kit by installing pg but I'd rather not do that, even as a dev dependency, if I can help it. The warning (src) conflicts with the advice given when no driver is installed (src):...

Enum's created in schema are unqualified when used in tables

Seeing an issue where when I'm trying to define enums and tables within a postgres schema, the enums are created within the schema, however the table columns reference the schema unqualified. Is there something I'm missing here? ```ts // schema defs ...

Updating drizzle and want to make sure I 100% understand the changes

I started noticing in my schema.ts I was getting this warning
The signature '(name: "seasons", columns: { id: IsPrimaryKey<NotNull<PgSerialBuilderInitial<"id">>>; year: NotNull<PgIntegerBuilderInitial<"year">>; start: NotNull<...>; end: NotNull<...>; }, extraConfig: (self: { ...; }) => PgTableExtraConfig): PgTableWithColumns<...>' of 'pgTable' is deprecated. (ts 6387)
The signature '(name: "seasons", columns: { id: IsPrimaryKey<NotNull<PgSerialBuilderInitial<"id">>>; year: NotNull<PgIntegerBuilderInitial<"year">>; start: NotNull<...>; end: NotNull<...>; }, extraConfig: (self: { ...; }) => PgTableExtraConfig): PgTableWithColumns<...>' of 'pgTable' is deprecated. (ts 6387)
...

kids-parents relation - is it possible?

I'm trying to setup relations between kids and parents. kids has father_id and mother_id columns that reference the parents.id. So far I have:...

Unique constraint violation error is not clearly surfaced in Drizzle ORM

When inserting into a table with a unique constraint, Drizzle ORM throws a generic error like Failed query, without surfacing the actual PostgreSQL error message or code (23505). Expected: A clear error or exception message indicating that a unique constraint was violated, ideally with the offending column and value....

How can I extend queries with additional fields

I have the following model: ```export const titleEnum = pgEnum("title", ["Mr.", "Mrs.", "Ms.", "Miss.", "Dr."]); export const Client = pgTable("client", {...

drizzle-kit generate error

Hi guys, I'm using drizzle with expo sqlite. Everything worked fine so far but suddenly I cannot generate migration as drizzle-kit generate fails with the following error: ```
npx drizzle-kit generate
...

Json as a string

I currently have this schema: ```ts export const decks = mysqlTable("decks", { uuid: char("uuid", { length: 36 }).primaryKey(), name: varchar("name", { length: 25 }).notNull(),...

how to do unit test using drizzle ?

how to unit test this ? : ```import { eq } from 'drizzle-orm'; import { db } from '../db/connection'; import { usersTable } from '../db/schema';...