17 lines
580 B
SQL
17 lines
580 B
SQL
-- 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');
|