feat(auth_token): Set approximate_last_access_time when token is issued

pull/4445/head
Timothy Messier 2 years ago
parent 07b3a7a19e
commit 585b344da6
No known key found for this signature in database
GPG Key ID: EFD2F184F7600572

@ -0,0 +1,19 @@
-- Copyright (c) HashiCorp, Inc.
-- SPDX-License-Identifier: BUSL-1.1
begin;
create function auth_token_before_issued() returns trigger
as $$
begin
if new.status = 'token issued' then
new.approximate_last_access_time = now();
end if;
return new;
end;
$$ language plpgsql;
create trigger auth_token_before_inserted before insert on auth_token
for each row execute procedure auth_token_before_issued();
create trigger auth_token_before_updated before update on auth_token
for each row execute procedure auth_token_before_issued();
commit;
Loading…
Cancel
Save