Drizzle Team

DT

Drizzle Team

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

Join

`drizzle-zod` and `z.nativeEnum()`

struggling to get drizzle-zod to work with z.nativeEnum after upgrading - as per the image, if i provide z.nativeEnum during createSelectSchema, it overrides all other types generated by drizzle-zod (see last 4 lines)
No description

[postgres] composite key does not result in constraint creation

i have this schema, and even though I've got a pretty basic composite primary key, whenever i go into a visual view of my db, no constraint is actually created. with other tables with single column pk's, it creates the constraint like ${tableName}_pkey, but in this case when i look on Neon there's no constraint here ```ts export const preferenceTable = createTable( 'preference', {...

Self referencing composite primary key table

I'm trying to define a table where each organization can define a parent-child set of locations. Each location has a composite primary key (org, id) but i can't seem to get the self referencing foreign keys to work. Is there a way to accomplish what i'm trying to do? here's my code. Thanks! ``` export const locations = pgTable( 'locations', {...

CORS error when trying to open Drizzle Studio with Supabase

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://localhost:4983/. (Reason: CORS request did not succeed). Status code: (null). https://localhost:4983/ just shows 404 Not Found I'm using "drizzle-orm": "^0.38.2" and "drizzle-kit": "^0.30.1". My browser is Firefox Developer and I'm on Linux. My Supabase database settings enforce SSL so not sure if that's related....

query where condition on foreign key relation

i have a table with a foreign key (one relation) to another table: ```export const mapRegions = sqliteTable( 'map_regions', { id: integer('id').primaryKey(),...

sqliteTable is deprecated

Apparently sqliteTable is deprecated and I couldn't find the replacement for it.

Drizzle Kit Schema Diff?

Is it possible to use drizzle kit to detect if there are schema differences, without actually applying them? I'd love to create a CI/CD job that looks at the production schema and blocks merging new code in until any schema changes have been published.

drizzle-zod is not sending custom message upon validation

I have created the following loginValidationSchema which I call in a validateData middleware inside my routes. I was expecting the custom error message to be sent to user whenever the user does not provide a value but it is not working \ zod-schema ```export const loginUserSchema = createSelectSchema(user, { email: (schema) =>...

Driver error callback

I'm trying to upgrade to 0.3.4 with the new drizzle client and am wondering how you are supposed to access driver callback events like 'error' or 'end'. My current code looks like this: ``` const pg = new pg.Client(...); const db = drizzle(pg, { schema }); pg.on("error", () => ...)...

Sequence problem with drizzle-seed

I'm experiencing an issue where after seeding data into a PostgreSQL table with Drizzle ORM, the sequence (users_id_seq) doesn't update to reflect the highest id inserted. Here are the details: Schema: ```export const users = pgTable("users", { id: serial().primaryKey(),...

Update column ONLY enabled when column is set as NOT NULL #3666

TL;DR: // Sharing this on Discord to find some help and explanation about the title. After the first problem that started as a discussion on github and not get any attention, I'm trying to reach you guys through discord....

Column not created even though appears in migration file

Hey team - I'm noticing a column that isn't created in my database, even though the schema + migration file clearly show that it is. Setup: - docker postgres running locally - drizzle-kit: "^0.28.0"...

Unexpected error happened 😕

```ts import { env } from "@/env.mjs"; import type { Config } from "drizzle-kit"; const path = "./src/server/lib/db";...
No description

Drizzle always says data exists even tho it can be undefined in ts.

export const selectRenter = async (name: string) => {
return db.select().from(renter).where(eq(renter.name, name));
};
export const selectRenter = async (name: string) => {
return db.select().from(renter).where(eq(renter.name, name));
};
This is my service....

Is this community still active?

For such a large OSS project with so many backers and users, it sure is quiet here.

"There is not enough information to infer relation" with many to many query

Hey there, I'm encountering the following error message when trying to do a many to many query:
ERR error: There is not enough information to infer relation "locations.tags"
...

drizzle-zod 0.6.0 breaks my createSelectSchema vs 0.5.1

subject line says it. the result of createSelectSchema returns a schema that has all fields nullable. No other changes other than upgrading from 0.5.1

Issue with $defaultFn and Column Typing in SQLite

Hey Drizzle team! 👋 When using $defaultFn in an SQLite schema, it seems like column typing gets ignored during inserts and updates. Is there a plan or timeline to address this issue?

Can't upsert with onConflictDoUpdate & generatedAlwaysAsIdentity ID columns?

I've noticed the type system doesn't recognize the ID columns (since they are supposed to be autogenerated?) How would one upsert or update? The ID field is not available ```ts...

Cannot generate Typebox schema from Drizzle Enum

i just trying to do the same thing as show in the docs here: https://orm.drizzle.team/docs/typebox#select-schema so i just copy and paste this from the docs: import { pgEnum } from "drizzle-orm/pg-core"; import { createInsertSchema } from 'drizzle-typebox'...
Next