Drizzle Team

DT

Drizzle Team

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

Join

Nuxt3 type error

Hello, is there somebody who used Drizzle in Nuxt3 project? I have problem with inheriting types from api, but only when I select specific columns from db. Server-side code shows correct types. Problem is on client-side, like you can see on photo. It gives mi correct type OR default type... Server-side ```ts...

Syntax error mysql migration using composite primary key

``sql --> statement-breakpoint CREATE TABLE member_to_address ( member_id varchar(32) NOT NULL, address_id` varchar(32) NOT NULL...

when using planetscale, using the `.$with()` and `.with()` clauses causes error

Is it not possible to use $with() and with() with planetscale? it gives the following error: DatabaseError: unsupported: with expression in select statement from the @planetscale/database package...

Zod prototype mismatch

Even though the Zod object constructor name created by Drizzle is ZodObject, it is not an instanceof ZodObject. This is causing an error in another library I am using that accepts ZOD objects. Since I've got Zod as a peer dependency, it should be expected that drizzle-zod is using that version when it creates a Zod objects? I could be off here. It appears that drizzle-zod has ZOD as a peer dependecy, but drizzle-orm does not?...

unrecognized_keys

Getting the following error when running generate:pg ``` ZodError: [ { "code": "unrecognized_keys",...

Raw SQL / Postgres stored generated column in schema

Is it possibile to add raw sql, or more specifically stored generated columns to the schema? Trying to store a length field of a text column.

I think i have found another bug

typescript complaining when there's no overriding

Custom getter/setter for model's property

Hi, are there any plans for custom getters? (like in TypeORM transformer)

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?