lockserver/db/queries/issued_codes.sql

18 lines
580 B
MySQL
Raw Normal View History

2024-11-23 03:50:18 +00:00
-- name: CreateIssuedCode :one
INSERT INTO issued_codes (name, code, start, end) VALUES (?, ?, ?, ?) RETURNING id;
-- name: DeleteIssuedCode :exec
DELETE FROM issued_codes WHERE id = ?;
-- name: AssignIssuedCodeSlot :exec
INSERT INTO issued_code_slots (issued_code, lock, slot) VALUES (?, ?, ?);
-- name: UnassignIssuedCodeSlot :exec
DELETE FROM issued_code_slots WHERE issued_code = ? AND lock = ?;
-- name: GetAllIssuedCodes :many
SELECT * FROM issued_codes;
-- name: GetActiveCodes :many
SELECT * FROM issued_codes WHERE start < datetime('now') AND end > datetime('now');