Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
Essentially, if the sender_id and receiver_id are a match to an existing pair it means you already sent that request. How can I write a policy that rejects the 2nd insert
I would like to set up a table in PostgreSQL such that two columns together must be unique. There can be multiple values of either value, so long as there are not two that share both.
Ah okay, so I have something similar right now. A friend_requests table where users can post requests to. The user can choose to accept or decline which will trigger a function that if it's accept inserts into the friendships table a new row. If rejected it's just deleted.