chore: split queries.sql into files by table (#762)

This commit is contained in:
Colin Adler
2022-04-01 15:45:23 -05:00
committed by GitHub
parent 2b1a0ee126
commit fd523100bf
27 changed files with 2816 additions and 2770 deletions

View File

@ -0,0 +1,68 @@
-- name: GetProjectByID :one
SELECT
*
FROM
projects
WHERE
id = $1
LIMIT
1;
-- name: GetProjectsByIDs :many
SELECT
*
FROM
projects
WHERE
id = ANY(@ids :: uuid [ ]);
-- name: GetProjectByOrganizationAndName :one
SELECT
*
FROM
projects
WHERE
organization_id = @organization_id
AND deleted = @deleted
AND LOWER("name") = LOWER(@name)
LIMIT
1;
-- name: GetProjectsByOrganization :many
SELECT
*
FROM
projects
WHERE
organization_id = $1
AND deleted = $2;
-- name: InsertProject :one
INSERT INTO
projects (
id,
created_at,
updated_at,
organization_id,
"name",
provisioner,
active_version_id
)
VALUES
($1, $2, $3, $4, $5, $6, $7) RETURNING *;
-- name: UpdateProjectActiveVersionByID :exec
UPDATE
projects
SET
active_version_id = $2
WHERE
id = $1;
-- name: UpdateProjectDeletedByID :exec
UPDATE
projects
SET
deleted = $2
WHERE
id = $1;