lockserver/db/queries/user_codes.sql

15 lines
504 B
MySQL
Raw Normal View History

-- name: CreateUserCode :one
INSERT INTO user_codes (user, code, start, end) VALUES (?, ?, ?, ?) RETURNING id;
-- name: DeleteUserCode :exec
DELETE FROM user_codes WHERE id = ?;
-- name: AssignUserCodeSlot :exec
INSERT INTO user_code_slots (user_code, lock, slot) VALUES (?, ?, ?);
-- name: UnassignUserCodeSlot :exec
DELETE FROM user_code_slots WHERE user_code = ? AND lock = ?;
-- name: GetAllUserCodes :many
SELECT user_codes.*, users.name FROM user_codes, users WHERE user_codes.user = users.id;