easyai-ai-gateway/apps/api/migrations/0067_identity_secret_cleanup_queue.sql
chengcheng 4426eeccf7
All checks were successful
ci / verify (pull_request) Successful in 12m18s
chore(merge): 整合最新 main 与统一认证变更
合并远端生产 CI、依赖与 API 文档改动,保留统一认证和 SSF 能力。由于远端生产基线已占用 0062,将尚未发布的身份迁移整理为 0063 至 0068 的最终增量 Schema,移除仅用于开发期草稿升级的破坏性迁移步骤。

验证:go test ./...。其余生产门禁在合并提交后继续执行。
2026-07-17 19:06:37 +08:00

17 lines
816 B
SQL

CREATE TABLE IF NOT EXISTS gateway_identity_secret_cleanup_queue (
secret_ref text PRIMARY KEY CHECK (secret_ref ~ '^[a-z0-9][a-z0-9-]{0,127}$'),
not_before timestamptz NOT NULL,
status text NOT NULL DEFAULT 'pending' CHECK (status IN ('pending','claimed')),
claim_token uuid,
lease_expires_at timestamptz,
created_at timestamptz NOT NULL DEFAULT now(),
updated_at timestamptz NOT NULL DEFAULT now(),
CONSTRAINT gateway_identity_secret_cleanup_claim_check CHECK (
(status = 'pending' AND claim_token IS NULL AND lease_expires_at IS NULL) OR
(status = 'claimed' AND claim_token IS NOT NULL AND lease_expires_at IS NOT NULL)
)
);
CREATE INDEX IF NOT EXISTS idx_gateway_identity_secret_cleanup_due
ON gateway_identity_secret_cleanup_queue(status, not_before, lease_expires_at, updated_at);