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

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

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
Leftjoin works but With doesn’t
Good Morning,
I am having an issue with understanding why my query isn’t working
```ts
Db.query.matches.findMany({...
Unique statements with `WHERE`
How would i go about creating the following in drizzle? I have tried a few different ways and apparently im missing something
...
CREATE UNIQUE INDEX uq_tags_public_name
ON tags ((lower(name))) WHERE scope='PUBLIC';
CREATE UNIQUE INDEX uq_tags_public_name
ON tags ((lower(name))) WHERE scope='PUBLIC';
Does `.$defaultFn()` support Promises somehow?
I have custom SnowflakeId generator that is delaying its result in some edgecases (like time rollbacks and seqId overflows). I want to use this generator in my schema definition's
.$defaultFn()
, but it does not seems to allow me to put promise there? Any reason why or how to do it?
Is this something that was requested before?...Using drizzle-zod with superforms
I am working on a SvelteKit app where i use Drizzle (0.30.2), drizzle-zod (0.8.2) and Svelte superforms (2.27.1)
This is my drizzle SQLite schema:
```ts
export const dataset = sqliteTable('dataset', {...
Is this concat + string_agg with groupBy correct in Drizzle?
Hi everyone,
I’m working with Drizzle ORM (PostgreSQL) and trying to generate a
name
field that combines the product name with all of its attribute values, like:
"T-Shirt, Red, Large"
.
...drizzle-kit pull Command Error
I am getting an error when trying to regenerate the migration using the drizzle-kit pull command.
How to fix this issue.
....\node_modules\drizzle-kit\bin.cjs:19554
checkValue = checkValue.replace(/^CHECK\s((/, "").replace(/))\s$/, "");
^...
how to do unit tests?
I can't find any reliable resource on unit test where we mock the drizzle instance.
I don't want to set up a real db connection with either a docker container that I would run alongside my tests or with testcontainers.
because of the drizzle chain methods api it's not that convenient to use for example vitest
vi.spyOn
method
I tried to create a method that has a similar api to spyOn
but works with methods like so:
```...drizzle generate with name
when wanting to create a migration with a name, thats readable i get errors
npx drizzle-kit generate:mysql --name=init
result: error: unknown option '--name=init'
...What's a good flow for making sure migrations are applied to prod
I am using Drizzle with Supabase in my Next.js website. Locally I have ran
drizzle-kit generate
and drizzle-kit push
. I do have some updates in my supabase/migrations
folder that were committed in my PR. What's a good flow to make sure these changes get made to my prod DB? Run these commands locally but pointed to my prod DB? Or is there a proper way?How do I create a fk to a uuid column?
My schema:
```js
export const overlaysTable = pgTable("overlays", {
id: uuid("id").notNull().defaultRandom().primaryKey(),
ownerId: varchar("owner_id")...