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 type infer

Looks there is problem in createInsertSchema type inference. 🤔 (+ need drizzle-zod tag in this post)...

Why is drizzle-zod converting a string to enum?

It seems like it is converting mysql text() or varchar to enums<unknown>?

how to do ANY

need to do where 'myvariable' = ANY(mycolumn)

[BUG?] Postgres transactions throwing connection timeouts after a lot of queries

I think there's a syntax error in Postgres transactions ----> see screenshot cc: @bloberenober...

Unique Key Schema

I am trying to create an unique key on a table using a custom schema, the generated sql migration file does not produce the correct output and when I execute it the error relation "users" does not exist is thrown. Here is the code: https://codesandbox.io/p/sandbox/competent-faraday-xk9b2q?selection=%5B%7B%22endColumn%22%3A72%2C%22endLineNumber%22%3A19%2C%22startColumn%22%3A72%2C%22startLineNumber%22%3A19%7D%5D&file=%2Fsrc%2Fdata%2Fmigrations%2F0000_military_la_nuit.sql...

sqliteTable wrapper which modifies fields, with proper types

More of a TypeScript question, but I'm trying to create a wrapper for sqliteTable to add a set of standard fields (and keys) to the fields provided: ```ts import { sqliteTable, SQLiteTableFn } from "drizzle-orm/sqlite-core" ...

How to count joined table?

I'm trying to count rows returned by join for a query, basically the same as this: https://dba.stackexchange.com/questions/110850/count-rows-with-inner-joined-tables How to convert this to Drizzle? Any documentation I've missed regarding this kind of things? ```sql...

Config in Typescript?

Hello, after upgrading drizzle-kit to 0.17.4 my drizzle.config.ts file stopped working. Is it now required for the config to be in JSON format? Using this: drizzle-kit generate:mysql Returns following:...

Problem running a migration

Hello there, I'm currently facing an issue with a database migration. I have two simple tables defined in my code (shown below) that I'm attempting to migrate to a MariaDB server. ``` export const usersTable = mysqlTable('user', { id: int('id').primaryKey().autoincrement().notNull(),...

How do I connect to sqlite on fly.io?

I followed the instructions on fly.io on how to setup a project using sqlite. I believe I did it all correctly. I've created a volume and an app and I've linked the volume to the app. Now I don't know how to connect to the sqlite db on there. On local I simply do new Database('sqlite.db') but I don't know what to use on fly.io. There are no docs on fly.io about this either, and I already asked on their forums. Has anyone done this before? 🙂...

Enums

Can pgEnum be converted to zod enums?

Typescript build fails with large number of columns

I have a table with ~460 columns, and on trying to run typescript on my app, I'm getting "error TS2589: Type instantiation is excessively deep and possibly infinite." It goes away once I reduce the number of columns in the Drizzle mysqlTable call to <= 357. Is there any way to address this?

Selecting multiple relating rows

A more generic SQL question (Been out of SQL a while now 🙃 ) Given the following schema: ```typescript...

many-to-one transaction

Hello, I want to create transaction involving arbitrary number of inserts. For example, Artist (one table) and insert multiple Titles (another table). Not clear to me how to best accomplish based example provided: ```...

[BUG] drizzle-kit doesn't like imports outside of a module

`npx drizzle-kit generate:pg drizzle-kit: v0.17.4 drizzle-orm: v0.23.10 C:\Users\Abdul\Documents\GitHub\bodyshop-mgmt\src\env.mjs:2...

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?...