I'm trying to add some custom logic to one of my tables on Hasura Postgre.
id : PK | user_id : FK | tag_id : FK | is_active : bool |
---|---|---|---|
1 | abc | xyz | true |
2 | abc | xyz | false |
3 | abc | xyz | false |
Allow only one row with same pair of FK's but column is_active == true;
Allow multiple rows with same pair of FK's but column is_active == false;
...
How can I set Hasura up to in case of an insert or update, Hasura would update the old value with is_active = false and keep only the new one with is_active = true automatically.
Thanks!!!