From 57b6399950463f00f234438f6bf45d5ba4cb3ddb Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Sat, 25 May 2019 16:40:41 +0200 Subject: [PATCH] historicization of JHI_USER_AUTHORITY table --- .../historicization_UserAuthority.xml | 75 +++++++++++++++++++ .../resources/config/liquibase/master.xml | 1 + 2 files changed, 76 insertions(+) create mode 100644 src/main/resources/config/liquibase/historicization/historicization_UserAuthority.xml diff --git a/src/main/resources/config/liquibase/historicization/historicization_UserAuthority.xml b/src/main/resources/config/liquibase/historicization/historicization_UserAuthority.xml new file mode 100644 index 00000000..fa896dc5 --- /dev/null +++ b/src/main/resources/config/liquibase/historicization/historicization_UserAuthority.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CREATE TRIGGER jhi_user_authority_historicize + AFTER INSERT OR DELETE OR UPDATE ON jhi_user_authority + FOR EACH ROW EXECUTE PROCEDURE historicize(); + + + DROP TRIGGER jhi_user_authority_historicize + + + + + + SELECT * + FROM jhi_user_authority_history + WHERE history_id IN ( + SELECT max(history_id) AS history_id + FROM jhi_user_authority_history + WHERE history_transaction <= current_setting('history.transaction')::bigint + GROUP BY user_id, authority_name) -- must have a unique constraint + + + + diff --git a/src/main/resources/config/liquibase/master.xml b/src/main/resources/config/liquibase/master.xml index 9c0f7345..60f9a193 100644 --- a/src/main/resources/config/liquibase/master.xml +++ b/src/main/resources/config/liquibase/master.xml @@ -10,6 +10,7 @@ +