Files
tokens-reef/backend/migrations/056_add_api_key_last_used_at.sql
Developer da36506b89 fix: resolve P0/P1 code quality issues
P0 fixes:
- ModelError.Is(): use exact matching instead of substring contains()
- shouldClearStickySession: add context param for cancellation/tracing

P1 fixes:
- TODO stubs: return 501 Not Implemented errors
- validateInstanceSignature: deduplicate to shared validateCodeSignature()
- Error messages: standardize to English only
- http.go: remove pseudo if-else with duplicate branches
2026-03-31 11:39:18 +08:00

10 lines
307 B
SQL

-- 迁移:为 api_keys 增加 last_used_at 字段,用于记录 API Key 最近使用时间
-- 幂等执行:可重复运行
ALTER TABLE api_keys
ADD COLUMN IF NOT EXISTS last_used_at TIMESTAMPTZ;
CREATE INDEX IF NOT EXISTS idx_api_keys_last_used_at
ON api_keys(last_used_at)
WHERE deleted_at IS NULL;