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-kit introspect on postgresql database hangs

When I run drizzle-kit introspect it successfully connects to my database and fetches some tables, but hangs after that and does not pull anything else
No description

PostgresError: relation "public.artist" does not exist

Hi, I'm new to drizzle. I am getting this error while trying to apply migrations, ```  npm run db:migrate
app@0.0.1 db:migrate...

Relate one-to-many on each-other?

Okay so my schema might be a little bit confusing, and maybe it's not correct to do it this way. But I have a case where items are displayed under, let's call it "Project". So projects can have categories, but in any given category there can be an "Item"....
No description

How to create a reusable query that can receive different select values?

I have a query with a lot of filters and ordering logic that I want to reuse but with different selects across a few endpoints, something like this: ```ts getProjectQuery<T extends SelectedFields>(select: T, filters: ProjectFilters) { db .select(select)...
No description

Is it possible to add custom SQL for migration

I read about the possibility to add custom SQL for queries with sql.raw(). Is it somehow possible to add some additional SQL for migration like this? ```typescript // schema.ts...

Unique constraint typescript error

i want to make unique constraint based on two columns, but i always got an error for the first column argument. anyone know how to fix this?
No description

new to drizzle, need help with relations

I'm new to drizzle, can anyone explain why this code errors ```ts // Example model schema from the Drizzle docs // https://orm.drizzle.team/docs/sql-schema-declaration ...

How to run a join on the result of a union

I have a union await union(...) and I would like to join it with another table. What should I do? Should I put it inside the union query itself (as monsterous as it would become)?

Define custom migration SQL for drizzle

Is it possible to create custom Drizzle migration commands or SQL statements for unimplemented functions, like custom domains? We want to fully rely on Drizzle for DB schema migrations but need support for functions not yet implemented. What’s the recommended approach to safely include custom statements in the migration process?

Does drizzle support querying across multiple mysql databases (same mysql server)?

Here's some 'rough' code to demonstrate what I'm attempting to do... basically I have tables in two mysql databases (same mysql server). I can write SQL to query data from tables in different databases, but am struggling to get drizzle to do it. I saw that drizzle allows defining the database with mysqlSchema(). Looking at the query that is being generated, it is not using the mysql database (mysqlSchema). When the query is generated, it thinks both tables in the same mysql database (mysqlSchema). Maybe the 'rqb' doesn't support multiple databases or does drizzle not support querying across them yet?...

Drizzle-kit generate command failing asking to upgrade drizzle orm

I'm using drizzle-orm 0.33.0 and drizzle-kit 0.24.2 along wih Turso as my database provider. Whenever I'm running drizzle-kit generate, I'm getting the following error: Please install latest version of drizzle-orm....
No description

missing FROM-clause entry for table "subquery"

So I am trying to update a row while using a subquery for it but getting erro all the time
No description

`id` type is `undefined` when using `serial("id").primaryKey()`

```ts import { sql } from "drizzle-orm" import { boolean, pgTable, serial, uuid, varchar } from "drizzle-orm/pg-core" import { createInsertSchema } from "drizzle-zod" import type { z } from "zod"...
No description

sql placeholder with an array throws an error

when executing this code: ```ts const prepQuery = db .select() .from(table)...

How can I use returning values when doing a `batch`?

The documentation tells you how to do batches (which are the only way to do what is essentially a transaction on D1): https://orm.drizzle.team/docs/batch-api The problem is that I have to run the following statements: ```ts...

Upsert queries not returning the values after conflicts.

Hi everyone, I'm trying to do query to database which would either create user and return info or select the user if it exists and return values. I came to know about doNothingconflict and it seems to not work with returning values. Could anyone please look into this?

pulling schema from database

stuck on pulling database the queries still work when accessing data but using drizzle-kit push has this forever
No description

How do I load sqlite extensions for drizzle-kit?

I'm getting SqliteError: unknown function: ulid_with_prefix() when running drizzle-kit migrate due of the ulid extension I'm using. How do I load the extension within drizzle kit?