Use goose for migrations
This commit is contained in:
14
postgres/queries/budgets.sql
Normal file
14
postgres/queries/budgets.sql
Normal file
@ -0,0 +1,14 @@
|
||||
-- name: CreateBudget :one
|
||||
INSERT INTO budgets
|
||||
(id, name, last_modification)
|
||||
VALUES ($1, $2, NOW())
|
||||
RETURNING *;
|
||||
|
||||
-- name: GetBudgetsForUser :many
|
||||
SELECT budgets.* FROM budgets
|
||||
LEFT JOIN user_budgets ON budgets.id = user_budgets.budget_id
|
||||
WHERE user_budgets.user_id = $1;
|
||||
|
||||
-- name: GetBudget :one
|
||||
SELECT * FROM budgets
|
||||
WHERE id = $1;
|
Reference in New Issue
Block a user