mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: split queries.sql into files by table (#762)
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
-- name: GetOrganizationByID :one
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
organizations
|
||||
WHERE
|
||||
id = $1;
|
||||
|
||||
-- name: GetOrganizationByName :one
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
organizations
|
||||
WHERE
|
||||
LOWER("name") = LOWER(@name)
|
||||
LIMIT
|
||||
1;
|
||||
|
||||
-- name: GetOrganizationsByUserID :many
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
organizations
|
||||
WHERE
|
||||
id = (
|
||||
SELECT
|
||||
organization_id
|
||||
FROM
|
||||
organization_members
|
||||
WHERE
|
||||
user_id = $1
|
||||
);
|
||||
|
||||
-- name: InsertOrganization :one
|
||||
INSERT INTO
|
||||
organizations (id, "name", description, created_at, updated_at)
|
||||
VALUES
|
||||
($1, $2, $3, $4, $5) RETURNING *;
|
||||
Reference in New Issue
Block a user