DrizzleKit check constraint generation missing value
I added a constraint to this table:
This generated the following SQL in the migration file. You can see that $1 was returned which should have been a 0, since the minimum is 0. This then leads to failing migrations.
This leads to:
Error during migration: NeonDbError: there is no parameter $1
Is this a known bug?
4 Replies
You should try
The reason is that using Drizzle helpers (that's ok!), params are passed as query args and not has 'values'
I have an example here: https://drizzle.run/lxapec3034aaen4ou5cj28kr
Drizzle Run
View and Check constraint - Drizzle Run
Oh snap, noted. Perhaps the TypeScript types could be improved to force no raw numerics in there? Although that would be quite difficult since gt() is used in regular queries as well.
Should we also do this when running regular queries?
The team will look at this π. When running regular queries itβs not the same, you can pass 0 like normal.
We talked about fixing that or updating the doc
I had the same issue when I first try check π