1

I'd like to create multi field constraint. In the same way in which is possible in SQL for instance by specifying:

CREATE TABLE …. UNIQUE(field1, field2);

So that what is unique is the combination of fields.

Is it possible to enforce this constraint in Graphcool?

1 Answers1

0

You can use permission queries to achieve custom checks. For example you dont want that user be able to add multiple comments on Post, so you want that Comment.post_id and Comment.user_id be unique. Use this permission query for this

  SomeProposalExists(filter: {
    post: {
      id_not: $input_postId
    }
    user: {
      id_not: $input_userId
    }
  })