From f3a07e708105e471e6686689d4d121db76b10932 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Fri, 13 Sep 2024 08:46:16 +0200 Subject: [PATCH] basis.currentRequest(), basis.tx_journal_trigger() --- src/main/resources/db/changelog/0-basis/010-context.sql | 2 +- src/main/resources/db/changelog/0-basis/020-audit-log.sql | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/resources/db/changelog/0-basis/010-context.sql b/src/main/resources/db/changelog/0-basis/010-context.sql index c27330cc..10c24ad2 100644 --- a/src/main/resources/db/changelog/0-basis/010-context.sql +++ b/src/main/resources/db/changelog/0-basis/010-context.sql @@ -86,7 +86,7 @@ end; $$; Returns the current http request as set via `basis.defineContext(...)`. Raises exception if not set. */ -create or replace function currentRequest() +create or replace function basis.currentRequest() returns text stable -- leakproof language plpgsql as $$ diff --git a/src/main/resources/db/changelog/0-basis/020-audit-log.sql b/src/main/resources/db/changelog/0-basis/020-audit-log.sql index 8bd319e0..d0fe6082 100644 --- a/src/main/resources/db/changelog/0-basis/020-audit-log.sql +++ b/src/main/resources/db/changelog/0-basis/020-audit-log.sql @@ -71,7 +71,7 @@ select txc.*, txj.targettable, txj.targetop, txj.targetuuid, txj.targetdelta /* Trigger function for transaction audit journal. */ -create or replace function tx_journal_trigger() +create or replace function basis.tx_journal_trigger() returns trigger language plpgsql as $$ declare @@ -84,7 +84,7 @@ begin insert into tx_context (txId, txTimestamp, currentUser, assumedRoles, currentTask, currentRequest) values ( curTxId, now(), - currentUser(), assumedRoles(), curTask, currentRequest()) + currentUser(), assumedRoles(), curTask, basis.currentRequest()) on conflict do nothing; case tg_op @@ -125,7 +125,7 @@ begin createTriggerSQL = 'CREATE TRIGGER ' || targetTable || '_journal' || ' AFTER INSERT OR UPDATE OR DELETE ON ' || targetTable || - ' FOR EACH ROW EXECUTE PROCEDURE tx_journal_trigger()'; + ' FOR EACH ROW EXECUTE PROCEDURE basis.tx_journal_trigger()'; execute createTriggerSQL; end; $$; --//