feat(api-key): 增加 API Key 上次使用时间并补齐测试
This commit is contained in:
9
backend/migrations/056_add_api_key_last_used_at.sql
Normal file
9
backend/migrations/056_add_api_key_last_used_at.sql
Normal file
@@ -0,0 +1,9 @@
|
||||
-- 迁移:为 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;
|
||||
Reference in New Issue
Block a user