Replace id column with natural PK

This commit is contained in:
2022-03-04 21:56:12 +00:00
parent 442e87234c
commit fd6b77f154
4 changed files with 34 additions and 4 deletions

View File

@ -22,4 +22,11 @@ SELECT assignments.date, categories.name as category, category_groups.name as gr
FROM assignments
INNER JOIN categories ON categories.id = assignments.category_id
INNER JOIN category_groups ON categories.category_group_id = category_groups.id
WHERE category_groups.budget_id = @budget_id;
WHERE category_groups.budget_id = @budget_id;
-- name: UpdateAssignment :exec
INSERT INTO assignments (category_id, date, amount)
VALUES($1, $2, $3)
ON CONFLICT (category_id, date)
DO
UPDATE SET amount = $3;