Files
member-console/internal/identity/queries/users.sql
T
cgalo5758 b0072d8971 Consolidate domain tables into core schema
Squash the pre-production migration history into fresh core, fedwiki,
and stripe baselines and reduce the canonical source list to those
three streams.

Update sqlc configs, generated queries, raw SQL, tests, and docs while
keeping provider tables schema-qualified.

BREAKING: existing local database volumes must be wiped because goose
version history restarts from the new baselines.
2026-07-05 20:10:23 -05:00

23 lines
600 B
SQL

-- name: GetUserByOIDCSubject :one
SELECT * FROM core.users
WHERE oidc_subject = $1;
-- name: CreateUser :one
INSERT INTO core.users (oidc_subject)
VALUES ($1)
RETURNING *;
-- name: UpdateUserLogin :one
UPDATE core.users
SET last_login_at = $1, last_login_ip = $2
WHERE user_id = $3
RETURNING *;
-- name: EnsureSystemUser :exec
-- Idempotently insert the reserved, non-loginable system user (keyed on the
-- unique oidc_subject sentinel). Safe under concurrent boots; read back with
-- GetUserByOIDCSubject.
INSERT INTO core.users (oidc_subject)
VALUES ($1)
ON CONFLICT (oidc_subject) DO NOTHING;