typically you d use a `DELETE` operation
# spicedb
j
typically, you'd use a
DELETE
operation in
WriteRelationships
to remove the previous relationship and
CREATE
to add the new one, in a single call
k
ok, but it means I need to have smth like this in updates array
Copy code
[{
    operation: v1.RelationshipUpdate_Operation.DELETE,
    relationship: {
      resource: folderObjectReference,
      subject: employeeSubjectReference,
      relation: 'manager',
    },
  },
  {
    operation: v1.RelationshipUpdate_Operation.TOUCH,
    relationship: {
      resource: folderObjectReference,
      subject: employeeSubjectReference,
      relation: 'viewer',
    },
  }
]
so I need to check current relation (manager) anyway, or should I have delete operation for all of the remaining relations: manager, editor, blocked (except the new one: viewer)?
j
Generally you’d check but you can just add the others
If not present the delete will no op
9 Views