bluebell/database/queries/sites.sql

39 lines
671 B
MySQL
Raw Normal View History

-- name: GetSiteByDomain :one
2024-08-16 16:48:50 +01:00
SELECT *
FROM sites
WHERE domain = ?
2024-08-16 16:48:50 +01:00
LIMIT 1;
-- name: GetLastUpdatedByDomainBranch :one
SELECT last_update
FROM branches
2024-08-10 13:28:30 +01:00
WHERE domain = ?
AND branch = ?
AND enable = true
2024-08-10 13:28:30 +01:00
LIMIT 1;
2024-08-16 16:48:50 +01:00
-- name: AddSite :exec
INSERT INTO sites (domain, token)
VALUES (?, ?);
2024-08-16 16:48:50 +01:00
-- name: UpdateSiteToken :exec
UPDATE sites
SET token = ?
WHERE domain = ?;
-- name: AddBranch :exec
INSERT INTO branches (domain, branch, last_update, enable)
VALUES (?, ?, ?, ?);
-- name: UpdateBranch :exec
UPDATE branches
SET last_update = ?
WHERE domain = ?
AND branch = ?;
-- name: SetBranchEnabled :exec
UPDATE branches
SET enable = ?
WHERE domain = ?
AND branch = ?;