How would I get 2 unique values?
I got my post likes table.
But if I already have same post id with different user. It returns error "
LibsqlError: SQLITE_CONSTRAINT: SQLite error: UNIQUE constraint failed: post_like.post_id
"5 Replies
You have the postId as the primary key, that will implicitly add a unique constrain on that column.
This should be the way you do it: https://orm.drizzle.team/docs/indexes-constraints#composite-primary-key
Indexes & Constraints - DrizzleORM
Drizzle ORM | %s
Thank you so much!
on line 7: Im attaching post like. How would I get them in an array? Or is there any way to just get the count of it?
You'll probably need to do some json aggregation if you want to do it at the database level
You could also do it in JS/TS: https://orm.drizzle.team/docs/joins#aggregating-results
Joins [SQL] - DrizzleORM
Drizzle ORM | %s