Use new UpdateAssignmentWithDifference for ynab-import to prevent errors on duplicates

This commit is contained in:
2022-03-05 22:23:13 +00:00
parent a62ab543b0
commit 97de326527
3 changed files with 33 additions and 5 deletions

View File

@ -29,4 +29,11 @@ INSERT INTO assignments (category_id, date, amount)
VALUES($1, $2, $3)
ON CONFLICT (category_id, date)
DO
UPDATE SET amount = $3;
UPDATE SET amount = $3;
-- name: UpdateAssignmentWithDifference :exec
INSERT INTO assignments (category_id, date, amount)
VALUES($1, $2, $3)
ON CONFLICT (category_id, date)
DO
UPDATE SET amount = assignments.amount + $3;