Drizzle Team

DT

Drizzle Team

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

Join

Using drizzle postgres with trpc in Next.js app

I'm getting the following error with the below code: Module not found: Can't resolve 'dns'. For some reason, my Next.js app is trying to load drizzle on the client where it doesn't have access to Node modules. Has anyone ever run into this before? ```ts import { publicProcedure, router } from "../trpc";...

Cant get custom type to work with default value

I made a custom type for the interval type in postgres default values keep writing [object Object] to the migration file regardless of what I output in toDriver...
No description

Cannot read properties of undefined (reading 'endsWith')

Y try to push this in my supabase database
export const user_provider_topics = pgTable( 'influencer_topics', { uuid: uuid().defaultRandom().primaryKey().notNull(),...

How to select a subset of fields from a JSONB?

I'm using Postgres and can't figure out how to select a subset of JSONB fields? Is this supported yet?

How to resolve mutiple queries in a single request to postgres database?

I have more than one sql select statements that need to act independently and are not related to each other. Is there a clean, type-safe way to fetch results for all these select statements in one request to postgres instead of having to use Promise.all and making a seperate request for each select statement? Most probably what I'm asking for is a single select statement that contains the logic for all the three select statements below. ```typescript const usersQuery = db.select().from(users).where(eq(users.age, 24)); const accountsQuery = db.select().from(accounts).where(eq(accounts.verified, false)); const sessionsQuery = db.select().from(sessions).where(inArray(sessions.userId, userIds));...

Semicolon separated emails using drizzle-zod.

I have the following Schema definition for drizzle-zod: ``` export const RegistroSchema = createSelectSchema(registro, { correo: (schema) => schema.correo.email(), retencionRenta: (schema) => schema.retencionRenta.optional(),...

Seeding remote D1 database by running `.ts` file

how to seed data by running .ts file for a remote D1 database?

Deprecated function table.d.ts(26, 8): The declaration was marked as deprecated here.

``` import { pgEnum, pgTable as table } from "drizzle-orm/pg-core"; import * as t from "drizzle-orm/pg-core"; import { createInsertSchema, createSelectSchema } from "drizzle-zod"; export const customers = table(...
No description

Drizzle studio not updating

Hello, have been trying to add to my schema file: ```const RoleEnum = pgEnum("roles", ["user", "admin"]); export const users = pgTable("user", {...

Drizzle Expo Sqllite

is it possible to implement backend Sync with drizzle-expo-sqllite, like recording all changes in a Queue and running sync periodically(or when App is online), Similar to WatermelonDB? I am new to Drizzle and sqllite, any pointers will be appreciated....

Insert IF NOT EXISTS

I'm attempting to insert a row to a table, but only if a row doesnt already exist which has the same value for the column "content" and if it does, return that row like this: ` const [resource] = await db .insert(resources) .values({ content: 'John Doe' })...

Depreciated table

Hi everyone, pgTable is marked here as depreciated but I can't understand why : ```ts export const clinicsSessions = pgTable( 'clinicsSessions', {...

Does eslint-plugin-drizzle work with the new eslint.config.js and eslint 9?

I could only find docs about the legacy eslint config format

Drizzle better-sqlite3 WAL mode

Hello! Sorry if this was asked before but I couldn’t find a way to do it by searching. How should you enable WAL mode with drizzle? Is it enough to put it inside a migration file, or you need to somehow execute it when you connect...

Drizzle-Zod not supported in latest version of Drizzle-ORM

I tried upgrading to drizzle orm 0.36, but I was having problems similar to this github issue. I downgraded back and everything is working fine. Has anybody been having this issue? https://github.com/drizzle-team/drizzle-orm/issues/3125...

Unique Constraint

I'm slightly confused as to why my unique constraint doesn't work as expected. I have the following schema: `export const userPermissionsTable = pgTable(...
No description

Foreign Key, is this method deprecated?

facing a lot of problems using this syntax, somebody can help me? `import { foreignKey, index,...