internal/store/migrations/0062_web_session_idle.up.sql

9df917e73a67d15adecc3f45976690f6fcd4e47a
gitbay/internal/store/migrations/0062_web_session_idle.up.sql history · blame · raw

8 lines · 463 bytes

1-- expires_at slides forward on use, never past absolute_expires_at.
2-- Sessions open now keep their cap and get a full idle window from here.
3ALTER TABLE web_sessions ADD COLUMN absolute_expires_at TEXT;
4ALTER TABLE web_sessions ADD COLUMN last_used_at TEXT;
5UPDATE web_sessions SET
6    absolute_expires_at = expires_at,
7    last_used_at = strftime('%Y-%m-%dT%H:%M:%fZ','now'),
8    expires_at = min(expires_at, strftime('%Y-%m-%dT%H:%M:%fZ','now','+12 hours'));