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 throwing await is not available in the configured target environment

Hi, when using the generate:pg command i am getting this error: 'Top-level await is not available in the configured target environment ("node14")'

[Bug] Postgres migrations are broken on 0.23.10

Re-running the same postgres migration twice just throws an error that a particular table already exists. It looks like its always trying to deploy the first migration instead of using drizzle migrations table to reference and compare hashes

drizzle-kit doesn't pull foreign keys from supabase/postgres?

It's hard to really turn this into a proper bug report because, honestly, with Supabase there could be many root causes, but basically, when I use drizzle-kit to introspect my Supabase setup, it works pretty well, except: 1. It doesn't include any foreign keys 2. It doesn't include anything that's in the auth schema ...

Why does drizzle-zod create ZodString's instead of z.ZodStrings for mySQL?

I was testing out drizzle-zod for mySQL, and I know it's still actively being worked on. It seems like it was mostly working but it creates ZodStrings, instead of z.ZodStrings, and is not working with SuperForms for SvelteKit, which accepts a ZOD object. Should I not even being played around with drizzle-zod for mySQL? Or am I missing something?...

Query for Prisma like insert in multiple joined tables

Is there a way to achieve insert in multiple tables joined by foreign keys in one query like Prisma? ``` { orderStatus: OrderStatus.CART,...

Iterator for result set

I've got some big ass database tables that I'd rather not read into memory. In other languages there is an iterator attached to result set, but I haven't seen that in the JS/TS world anywhere. Is that something I'm going to have to write for myself, or have I missed it? What I'm imagining is either something that uses a DB cursor, or something that basically works like a paginator, where it will select 100 rows at a time, iterate over those rows, and keep doing that each time you call .next() until it has reached the end of the result set....

How to filter length in where for postgres?

I have a text field, which I want to select only if it's length is higher than 50. How should I do that? So I basically need to transfer where length(item.content) >= 50 to Drizzle.

Is there currently a way to utilize onUpdate?

Trying to run ON UPDATE NOW() for a last_updated column for whenever the row is changed.

Migrations not working on github actions

Any suggestions to debug this on actions? Is it possible that the database is not created?

"The supplied SQL string contains more than one statement" after running "generate:sqlite"

I just updated one of my schemas with a few columns and now my project is broken. This is the generated SQL ``sql ALTER TABLE projects ADD project_id` integer;...

[bug] Some sql statement looks broken when bulk insert

```ts await db.insert(users) .values( { name: 'Andrew',...

Return first or throw

I have a hard time believing this hasn't been asked yet, but my search results have yet to yield anything. Is it not possible (or planned) to do something like: ```ts const firstItem = db.select().from(users).where(eq(users.id, userId)).takeFirstOrThrow()...

Can't find meta/_journal.json file when running migrate

Trying to run migrate() from a lambda function and I can't figure out why it's unable to find the _journal.json file. My structure is in the attached image. In db.ts, I'm calling this migrate function like so: ```ts...

Wrong type on decimals

Hello, I have encountered something interesting. The first screenshot shows what I'm inserting into the products table, second shows the schema of the products table and the third one shows what I get when I query the products table. As you can see all decimal fields are now strings but typescript is telling me that they're numbers.
No description

Check

Hello there, from this discussion: https://discord.com/channels/1043890932593987624/1090486363251544124/1093092996200796200 Is it the way to add check constraint? ```ts...

cascades

I know you can add .references() to set up foreign keys in a table definition, but how do you set up cascades?

jsonb field definition.

What's the right way to define a jsonb field? I have a type type MetaData = {keywords?: string[];} and a field meta: jsonb<MetaData>("meta"), but I'm getting the typescript warnings Type 'PgJsonbBuilderInitial<MetaData>' is not assignable to type 'AnyPgColumnBuilder'.ts(2322) on the lhs and Type 'MetaData' does not satisfy the constraint 'string'.ts(2344) on the rhs. Thanks in advance.

"Extend" tables by other tables

Hey all, first of all great work with drizzle. Haven't had the time to play around with it so far. But just from how I currently use other orms. I have an AbstractEntity "class" which isn't an actual db table, but shares the common column each table should have e.g. a unique id. Basically like a parent class, but for DB tables....

maximum call stack exceeded

Weird bug where whenever I add a where eq clause getting maximum call stack exceeded

Drizzle recommended way to migrate reset

Apologies if this is a stupid question, I just recently migrated out of prisma and into drizzle. One of our common use cases for the dev DB was to run yarn prisma migrate reset when we wanted to reset our DB. Is there a drizzle equivalent way to do that?...