No overload matches this call

When inserting data into an table inside a transaction I get this error: (see attached). When I then infer the model like this: (see attached) the error is gone. Any other idea, how to solve that correctly? It seems to be wrong...
No description
No description
11 Replies
Aaroned
Aaroned•8mo ago
@B33fb0n3 can you share your exclusiveItems schema?
B33fb0n3
B33fb0n3OP•8mo ago
yes:
No description
B33fb0n3
B33fb0n3OP•8mo ago
this is the full error
No description
Aaroned
Aaroned•8mo ago
what is the type of newMediaId?
B33fb0n3
B33fb0n3OP•8mo ago
it's a string
Aaroned
Aaroned•8mo ago
actually there is two error messages there, I think the first is the issue... you are using a string (varchar) as primary key.... are you supplying a value?
B33fb0n3
B33fb0n3OP•8mo ago
doesnt InferInserType use the types from the schema? 🤔 you mean because of "uuid"?
Aaroned
Aaroned•8mo ago
because you are not using serial (ie. autoincrement integer), but rather a string, yes you need to supply a value or a defaultFn see https://orm.drizzle.team/docs/column-types/pg#default-value https://www.postgresqltutorial.com/postgresql-tutorial/postgresql-uuid/
id: uuid('id').defaultRandom()
id: uuid('id').defaultRandom()
B33fb0n3
B33fb0n3OP•8mo ago
ah ok got it. What type do I need to provide, if it's not a string?
Aaroned
Aaroned•8mo ago
you can use serial if you want an autoincrementing integer, or uuid with .defaultRandom() for a string uuid
B33fb0n3
B33fb0n3OP•8mo ago
Hm ok. I don’t want it to be a serial neither defaultRandom. I guess I will life with that „typeof“ then 🫠
Want results from more Discord servers?
Add your server