How to use "onConflictDoUpdate" with composite key?
If a user sends a friend request while one exists it should update to pending. But the "friends" table is using a composite key.
Table looks like this
query looks like this
Do I need to use a primary (non-composite) key in the friends table?
5 Replies
I believe you can do
target: [friends.senderUsername, friends.recipientUsername]
thank you
that's true, but still not a best solution I guess
for now it's the only one
but we will add some sort of callback, which can infer a list of composite keys for that
so you can just choose any you need
for now if you will change your schema and schema this primary pk, this code may be broken and won't show that something wrong. You will find that in runtime
didn't know that, thanks!
😎