Import category
This commit is contained in:
20
postgres/queries/categories.sql
Normal file
20
postgres/queries/categories.sql
Normal file
@ -0,0 +1,20 @@
|
||||
-- name: CreateCategoryGroup :one
|
||||
INSERT INTO category_groups
|
||||
(name, budget_id)
|
||||
VALUES ($1, $2)
|
||||
RETURNING *;
|
||||
|
||||
-- name: GetCategoryGroups :many
|
||||
SELECT category_groups.* FROM category_groups
|
||||
WHERE category_groups.budget_id = $1;
|
||||
|
||||
-- name: CreateCategory :one
|
||||
INSERT INTO categories
|
||||
(name, category_group_id)
|
||||
VALUES ($1, $2)
|
||||
RETURNING *;
|
||||
|
||||
-- name: GetCategories :many
|
||||
SELECT categories.*, category_groups.name as group FROM categories
|
||||
INNER JOIN category_groups ON categories.category_group_id = category_groups.id
|
||||
WHERE category_groups.budget_id = $1;
|
@ -1,7 +1,7 @@
|
||||
-- name: CreateTransaction :one
|
||||
INSERT INTO transactions
|
||||
(date, memo, amount, account_id, payee_id)
|
||||
VALUES ($1, $2, $3, $4, $5)
|
||||
(date, memo, amount, account_id, payee_id, category_id)
|
||||
VALUES ($1, $2, $3, $4, $5, $6)
|
||||
RETURNING *;
|
||||
|
||||
-- name: GetTransactionsForBudget :many
|
||||
|
Reference in New Issue
Block a user