Implement new budget with transaction to be able to satisfy not null columns

This commit is contained in:
2021-12-11 20:19:52 +00:00
parent 935499e3a8
commit 40a299141d
3 changed files with 40 additions and 0 deletions

View File

@ -4,6 +4,11 @@ INSERT INTO budgets
VALUES ($1, NOW())
RETURNING *;
-- name: SetInflowCategory :exec
UPDATE budgets
SET income_category_id = $1
WHERE budgets.id = $2;
-- name: GetBudgetsForUser :many
SELECT budgets.* FROM budgets
LEFT JOIN user_budgets ON budgets.id = user_budgets.budget_id