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

This commit is contained in:
jacob1123 committed 2022-03-05 22:23:13 +00:00
1 parent a62ab543b0
commit 97de326527
3 files changed
+33 -5

No files matched your search

+8 -1
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;