Currently when performing a Set operation on a collection, the constraint automatically defaults to the primary key. For example, the query generated would be something like this:
INSERT INTO <collection> (<columns>) VALUES (<values>) ON CONFLICT (_id) DO UPDATE SET ...
It would be great to have the ability to specify which constraint to use for set operation. If the collection has a unique constraint, the user should be able to do set operations for those cases:
INSERT INTO <collection> (<columns>) VALUES (<values>) ON CONFLICT (<constraint>) DO UPDATE SET ...
This can be implemented by accepting an additional argument, constraint, when calling the operation. It can be either a list of column names corresponding to the constraint, or just the constrain name itself.
Currently when performing a Set operation on a collection, the constraint automatically defaults to the primary key. For example, the query generated would be something like this:
INSERT INTO <collection> (<columns>) VALUES (<values>) ON CONFLICT (_id) DO UPDATE SET ...
It would be great to have the ability to specify which constraint to use for set operation. If the collection has a unique constraint, the user should be able to do set operations for those cases:
INSERT INTO <collection> (<columns>) VALUES (<values>) ON CONFLICT (<constraint>) DO UPDATE SET ...
This can be implemented by accepting an additional argument,
constraint
, when calling the operation. It can be either a list of column names corresponding to the constraint, or just the constrain name itself.