feat(auth): support optional expiry for bot API tokens
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
9
backend/migrations/0034_api_tokens_expires_at.sql
Normal file
9
backend/migrations/0034_api_tokens_expires_at.sql
Normal file
@@ -0,0 +1,9 @@
|
||||
-- Optional expiry for bot API tokens. NULL = never expires (the prior
|
||||
-- behaviour, preserved for all existing rows). When set, `find_active`
|
||||
-- rejects the token past this instant, mirroring the sessions table's
|
||||
-- `expires_at > now()` gate.
|
||||
ALTER TABLE api_tokens ADD COLUMN expires_at TIMESTAMPTZ;
|
||||
|
||||
-- Partial index to keep the active-token lookup cheap once expiries exist.
|
||||
CREATE INDEX api_tokens_expires_at_idx ON api_tokens (expires_at)
|
||||
WHERE expires_at IS NOT NULL;
|
||||
Reference in New Issue
Block a user