DrizzleOrm schema requires an id

I am having an issue with inserting a new user to my users table, because I need to pass the id unlike in prisma. Any ideas how I can kind of "skip" this part or just dynamically create it?
16 Replies
Neto
Neto•8mo ago
show the schema
Slavi
SlaviOP•8mo ago
here you go
No description
Slavi
SlaviOP•8mo ago
normally it should get added automatically, just like prisma
Neto
Neto•8mo ago
you created a text primary key, with no default value you need generate that or create a $defaultFn thing
Neto
Neto•8mo ago
- database native default value - $defaultFn on the schema - value on insert the options for primary key creation
Slavi
SlaviOP•8mo ago
because I am using sqlite I made it like this and I not see no error
No description
Slavi
SlaviOP•8mo ago
lets see hmm got an error "Function not implemented"
Neto
Neto•8mo ago
you need so check then you can use integer("id").primaryKey() and that should create a autoincrement field
Slavi
SlaviOP•8mo ago
let me try that
Slavi
SlaviOP•8mo ago
strange
No description
Slavi
SlaviOP•8mo ago
my id has no null constrains maybe we should ask sb that has used it before but I do not see sb that could help Oooh Nice
Slavi
SlaviOP•8mo ago
No description
Slavi
SlaviOP•8mo ago
Got it Thank you a lot! @nyx (Rustular DevRel)
Neto
Neto•8mo ago
very nice
Slavi
SlaviOP•8mo ago
DrizzleOrm is a different breed 🤣
Want results from more Discord servers?
Add your server