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.
23 lines
600 B
SQL
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;
|