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 returning BuildSchema instaed of zod schema

Im trying to create zod schema from drizzle schema, but this is returning an buildschema, that dosen´t seam right. What im doing wrong?
No description

how to properly auto migrate db in prod

so i have set up some automations to auto deploy my application that uses drizzle but i dont know what is the correct way to make it migrate. Like when i should do it

Non-interactive abort on data loss push

Hello, I am huge fan of drizzle-kit push but I struggle to find the best way to integrate it to into CI. I was first thinking of using --strict and --verbose to sort of get what I want, but now if any dev forgets to push on their own machine, the CI machine just hangs at the interactive prompts. I am essentially wanting a non-interactive drizzle-kit push that will abort on data loss....

Parameterization from string and array of values

I have a sql string with placeholders and an array of values for those placeholders. How can I have drizzle parameterize and execute it? for context I'm trying to have pg-boss use the same session as my drizzle transaction. pg-boss generates strings and arrays of values, but I can't find anything to render the sql in the api. I am using node-postgres. ...

json column returning as string

Hello, i'm having some trouble querying from a table that has a text column with mode set to JSON. The data is returning as a stringified json, is this the expected behavior? I'm using the better-sqlite3 driver btw....
No description

Drizzle ORM HTTP SQlite proxy does not work with JSON mode text

Hey, another issue: The drizzle http proxy for sqlite always throws a tantrum when it encounters any column with json text. Here is the error: ```log iscord API Error: SyntaxError: "undefined" is not valid JSON at JSON.parse (<anonymous>)...

returning insert values undefined with drizzle http sqlite proxy

Hey, I just ran into an issue while using drizzle-orm/sqlite-proxy when used with the returning() statement. This is what my db client looks like: ` ```ts...

How to add self-signed certificate for studio gateway?

AWS RDS uses self-signed certificate, currently there is no way on studio gateway to disable the check or add custom certificate.

TypeScript and Runtime Error when using string constants in relations references array

Hello! I'm trying to define a relation where one table can reference multiple different tables based on a type (literal) field, but I'm encountering both TypeScript and runtime errors when trying to use string constants in the references array....

Chat am I cooked?

```log dog@dog MINGW64 ~/Documents/GitHub/www.airnode.nl (main) $ bun run db:studio $ drizzle-kit studio No config path provided, using default 'drizzle.config.ts'...

Reset migrations for production

Hello! During development I have been using migrations to sync changes to our staging environment. Before going live on production I messed up and forgot to reset all migrations and start from scratch. What we have now is a mess with 38 migration files. I have manually made edits in some of the migrations files (I know..) and staging won't accept migrations due to conflicts. I have been forcing changes with push for some time. Now we have our prod live since a week with not much, but some data that I want to keep. Before it goes too far I want a clean slate on migrations with the current state as a baseline. ...

query array

Hi everyone, can I query an array of strings (inserting, removing, searching) for elements?

Adding unique() to an existing table in Supabase

Is it possible to add (table) => [unique().on(table.userId, table.division, table.week, table.year, table.sportId)] on an existing table? I just noticed that duplicate data has been entered into one of my tables from a form that's submitted on my site. I just realized it happened last year once and then again this year. LKooking at my schema I don't have a unique() for this particular table. Is it possible to add that and then run drizzle-kit generate followed by a drizzle-kit migrate to then add that? Will it mess anything up with the existing tabler? Also, can I update an existing unique?...

Invalid relation

I've been following https://orm.drizzle.team/docs/relations to try and make a many to many relation between one table (users to users, each user can have friends) but when I try run studio to see it work this happens:
Failed to extract relations. This is likely due to ambiguous or misconfigured relations.
Please check your schema and ensure that all relations are correctly defined.
See: https://orm.drizzle.team/docs/relations#disambiguating-relations
Error message: Invalid relation "friends" for table "users"
Failed to extract relations. This is likely due to ambiguous or misconfigured relations.
Please check your schema and ensure that all relations are correctly defined.
See: https://orm.drizzle.team/docs/relations#disambiguating-relations
Error message: Invalid relation "friends" for table "users"
...

Login failed, why?

it just created the password randomly (permitted by me) but when i open the drizzle local, it just says wrong password, why? to create password i used "./start-database.sh"...
No description

pushSQLiteSchema with force parameter?

im trying to use pushSQliteSchema function (imported from drizzle-kit/api) but when it tries to push changes i get a warning regarding data loss, which makes sense but is there any way i can skip those warnings and just push my schema (i know its a terrible idea but dont worry about it)?
No description

jsonb with bigint gets "Do not know how to serialize a BigInt"

with a postgres jsonb column that has a bigint in it, when doing and inserts/updates to the column you get the error: ```ts TypeError: Do not know how to serialize a BigInt at JSON.stringify (<anonymous>)...

Check connection

Stupid question, but how do you check if connection is alive? Didnt find anything in docs, even google is empty (probably asking the wrong way). Im using mysql if that changes anything......

Drizzle Gateway: can't open db file

I'm trying to run Drizzle Gateway to connects to an sqlite file...however when i link to the file i get a File already exists error...what am i missing? Obviously the file has to exist
Next