This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Generic Audit Trigger | |
Linear Time Record Version History | |
Date: | |
2022-02-03 | |
Purpose: | |
Generic audit history for tables including an indentifier | |
to enable indexed linear time lookup of a primary key's version history |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Available on RDS and Google Cloud SQL | |
create extension if not exists "uuid-ossp"; | |
-- A shared numeric sequence to prepend to the UUID | |
create sequence if not exists global_seq_id; | |
create function next_guid() returns uuid as | |
$$ | |
select ( | |
to_char(nextval('global_seq_id'), 'fm0000000000') |