c8a4a930ea
Adds Insert/Get/Touch/Delete helpers over the sessions table. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
17 lines
443 B
SQL
17 lines
443 B
SQL
-- name: InsertSession :one
|
|
INSERT INTO sessions (user_id, token_hash, user_agent)
|
|
VALUES ($1, $2, $3)
|
|
RETURNING *;
|
|
|
|
-- name: GetSessionByTokenHash :one
|
|
SELECT * FROM sessions WHERE token_hash = $1;
|
|
|
|
-- name: TouchSessionLastSeen :exec
|
|
UPDATE sessions SET last_seen_at = now() WHERE id = $1;
|
|
|
|
-- name: DeleteSession :exec
|
|
DELETE FROM sessions WHERE id = $1;
|
|
|
|
-- name: DeleteSessionByTokenHash :exec
|
|
DELETE FROM sessions WHERE token_hash = $1;
|