How to ensure unique constraints


#1

I am coming from the RDBMS world. so forgive if I ask a badly phrased question.

I have a situation where I need to ensure unique or partial unique populating data inside cayley

In RDBMS such as postgres, I can build a table like this:

  1. primary autoincrement key called id
  2. foreignkey to person table called person_id
  3. foreignkey to product table called product_id
  4. foreignkey to price table called price_id
  5. boolean field called is_removed

If i want a unique constraint such as the entire table can have a unique index such that product_id and price_id are together as a pair must be unique, I can do that.

if i want a partial unique constraint in postgres where if the is_removed is False, then the person_id, product_id, and price_id are unique.

Then if the foreignkeys are null, the constraints are not triggered.

How do I have something this inside cayley?