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 @@ +