You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.0 KiB
43 lines
1.0 KiB
-- name: GetScope :one
|
|
SELECT * FROM scope
|
|
WHERE id = ?;
|
|
|
|
-- name: ListScopes :many
|
|
SELECT * FROM scope
|
|
ORDER BY name;
|
|
|
|
-- name: ListScopesByUser :many
|
|
SELECT s.* FROM scope_member sm
|
|
RIGHT JOIN scope s on s.id = sm.scope_id
|
|
WHERE sm.user_id = ?
|
|
ORDER BY s.name;
|
|
|
|
-- name: ListScopeMembers :many
|
|
SELECT * FROM scope_member
|
|
WHERE scope_id = ?
|
|
ORDER BY name;
|
|
|
|
-- name: ListScopeMembersMulti :many
|
|
SELECT * FROM scope_member
|
|
WHERE scope_id IN (?, ?, ?, ?, ?, ?)
|
|
ORDER BY name;
|
|
|
|
-- name: InsertScope :execresult
|
|
INSERT INTO scope (id, name, abbreviation, custom_labels)
|
|
VALUES (?, ?, ?, ?);
|
|
|
|
-- name: UpdateScope :exec
|
|
UPDATE scope SET name = ?, abbreviation = ?, custom_labels = ? WHERE id = ?;
|
|
|
|
-- name: ReplaceScopeMember :exec
|
|
REPLACE INTO scope_member (scope_id, user_id, name, owner)
|
|
VALUES (?, ?, ?, ?);
|
|
|
|
-- name: DeleteScopeMember :exec
|
|
DELETE FROM scope_member WHERE scope_id=? AND user_id=?;
|
|
|
|
-- name: DeleteAllScopeMembers :exec
|
|
DELETE FROM scope_member WHERE scope_id=?;
|
|
|
|
-- name: DeleteScope :exec
|
|
DELETE FROM scope WHERE id=?;
|