Drizzle Team

DT

Drizzle Team

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

Join

How to get Cloudflare D1 meta information?

Hi all, is there any way to get meta information from executed query? See the attachments. https://developers.cloudflare.com/d1/build-with-d1/d1-client-api/#return-object...
No description

Drizzle Push to Turso fails on third attempt

If I use drizzle push on an empty turso db the first push works fine. (command: "pnpm db:push") After that if I run push again, it thinks that the schema doesn't match and it applies some changes. On the third db:push attempt it tries to do the changes again but this time it fails and it leaves the db in an "broken" state. (Because It has some _old tables left and the new ones are missing the values of the _old one.) I see two issues here....

Keep getting relation constraint error when migrating

I have the following table where I set both the userId and eventId unique. ```typescript export const userToEvent = pgTable( 'user_to_event', {...

Altering existing table with Timestamp column to Timestamp with Timezone in Postgres using Drizzle

I have an existing table with columns such as created_at with data type of timestamp. I want to update the column, so that every single timestamp in my database will be timestamp with timezone. I tried modifying db schema from JS by changing ```js createdAt: timestamp("created_at") .defaultNow() .notNull(),...

Exclude table from migration

I have an existing table from another schema from supabase's auth. ``` const authSchema = pgSchema("auth"); export const users = authSchema.table("users", {...

relations.ts alway include column name

Currently drizzle does not include the column name in the introspected relation name in relations.ts if only one column references a certain table [tableName] and not [tableName]_[columnName]. This makes the naming unstable as in the future when another column that relates to the same table is added, the first relation name stops making sense. Can I configure drizzle to alway include the column name in the relation name?

query about orm customization

can I custom code and add a custom property like
bigint("id").MyCustomMethod().primaryKey()
bigint("id").MyCustomMethod().primaryKey()
Is it possible or not possible from user side and needs to be create from the library it self?...

Error: There are multiple relations between "__public__.shareTransferHistory" and "client".

This just recently became a problem and I can't figure out why. Here's my schema: https://gist.github.com/aaronfulkerson/a73f3745ce04d0a2b62ffd26c6457833 I'm using relationName to disambigurate the relations on shareTransferHistory but I'm completely lost. I feel like this was working until very recently but can't figure out why it's suddenly broken....
Solution:
I needed to also add relationName to the other table.

Supabase generated typescript types + relations

Hello, I'm using supabase generated typescript types to type my api calls and results, I use drizzle relational querying and it works fine. But when I add relations to my query (ex: with: { table: true }) then the type doesnt match anymore as there is a new prop with a new type. Is there a solution ?

How do errors work?

When does drizzle throw errors, if I call find first and it doesn't find anything will it throw?

When use drizzle-kit drop command got an error: Error Please specify 'dialect' param

Hello! I'm working on drizzle/neon setup and at the moment I would like to drop my migrations which is stored inside of this directory:
src/libs/packages/drizzle/migrations
src/libs/packages/drizzle/migrations

Issue:...

I want to create Auth with Supabase and drizzle-orm.

Can someone please tell me how to do this? ``` export async function signup(formData:FormData){ const supabase=createClient() ...

Issue with Drizzle ORM and drizzle-kit push with Tembo Cloud PostgreSQL

Hello everyone, I'm currently working on a project using Drizzle ORM with PostgreSQL hosted on Tembo Cloud. My PostgreSQL database has the pg_stat_statements extension installed by default. I'm encountering an issue when trying to push my schema changes using drizzle-kit. Issue:...
No description

Anyone had luck with copilot?

Hello all! I've been using Drizzle on my project since last year, and I love it, team loves it, but for some reason no matter how many queries we have in our code, copilot doesn't seem to know we're using Drizzle. E.g. it always makes this kind of wrong suggestion:...
No description

drizzle-kit generate migrations error: Please specify 'dialect' param (dialect param is included)

I would like to generate migrations but when I run the following command:
npx drizzle-kit generate --config drizzle.config.ts --dialect postgresql
npx drizzle-kit generate --config drizzle.config.ts --dialect postgresql
I got this output:...

Drizzle-kit migrate

I got this error running the migration on a postgresql database hosted on supabase in local: ```sh ❯ pnpm drizzle-kit migrate --config src/config.ts drizzle-kit: v0.22.7 drizzle-orm: v0.31.2...

Monorepo and schemas, how to structure

I was wondering if anyone had any advice/thoughts on how best to structure a monorepo project when it comes to schemas. I currently have a single "database" package that has all my schemas and migrations. Is there a "better" way to do it? It seems wrong to have the schemas separate form the package that it relates to, but at the same time it seems simpler than trying to figure out a way to manage schemas and migrations across multiple packages.....

😮💨 Yarn Workspace Monorepo Help

I’m trying to setup a Monorepo using yarn workspaces. I want to use Drizzle as the ORM. I have attached some pictures of the file structure etc. I know the connection to the DB works as I have run migrations etc. but when I try and use a query on the nextjs app I get the Aggregate error. I can find anything online to help. I’m hoping someone has had a similar issue and figured it out 😅...
No description

Multiple FROM support (word_similarity) fuzzy search

I'm trying to create this SQL: ``` SELECT *, similarity FROM "app-user", word_similarity('test query', "fullName" || "email") as similarity...

postgres schema indexes INCLUDE

this is pretty important features for indexes, is there a way of using "INCLUDE " when creating index? or a workaround? like: CREATE UNIQUE INDEX title_idx ON films (title) INCLUDE (director, rating);...