-- name: CreateAssignment :one
INSERT INTO assignments (
        date, amount, category_id
) VALUES (
        $1, $2, $3
)
RETURNING *;

-- name: DeleteAllAssignments :execrows
DELETE FROM assignments
USING categories
INNER JOIN category_groups ON categories.category_group_id = category_groups.id
WHERE categories.id = assignments.category_id AND category_groups.budget_id = @budget_id;
