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
show the schema
here you go
normally it should get added automatically, just like prisma
you created a text primary key, with no default value
you need generate that or create a $defaultFn thing
Drizzle ORM - DrizzleORM v0.28.3 release
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
- database native default value
- $defaultFn on the schema
- value on insert
the options for primary key creation
because I am using sqlite I made it like this and I not see no error
lets see
hmm
got an error "Function not implemented"
you need so check then
you can use integer("id").primaryKey() and that should create a autoincrement field
let me try that
strange
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
Got it
Thank you a lot!
@nyx (Rustular DevRel)
very nice
DrizzleOrm is a different breed 🤣