basis.currentRequest(), basis.tx_journal_trigger()
This commit is contained in:
parent
d0558bed36
commit
f3a07e7081
@ -86,7 +86,7 @@ end; $$;
|
|||||||
Returns the current http request as set via `basis.defineContext(...)`.
|
Returns the current http request as set via `basis.defineContext(...)`.
|
||||||
Raises exception if not set.
|
Raises exception if not set.
|
||||||
*/
|
*/
|
||||||
create or replace function currentRequest()
|
create or replace function basis.currentRequest()
|
||||||
returns text
|
returns text
|
||||||
stable -- leakproof
|
stable -- leakproof
|
||||||
language plpgsql as $$
|
language plpgsql as $$
|
||||||
|
@ -71,7 +71,7 @@ select txc.*, txj.targettable, txj.targetop, txj.targetuuid, txj.targetdelta
|
|||||||
/*
|
/*
|
||||||
Trigger function for transaction audit journal.
|
Trigger function for transaction audit journal.
|
||||||
*/
|
*/
|
||||||
create or replace function tx_journal_trigger()
|
create or replace function basis.tx_journal_trigger()
|
||||||
returns trigger
|
returns trigger
|
||||||
language plpgsql as $$
|
language plpgsql as $$
|
||||||
declare
|
declare
|
||||||
@ -84,7 +84,7 @@ begin
|
|||||||
insert
|
insert
|
||||||
into tx_context (txId, txTimestamp, currentUser, assumedRoles, currentTask, currentRequest)
|
into tx_context (txId, txTimestamp, currentUser, assumedRoles, currentTask, currentRequest)
|
||||||
values ( curTxId, now(),
|
values ( curTxId, now(),
|
||||||
currentUser(), assumedRoles(), curTask, currentRequest())
|
currentUser(), assumedRoles(), curTask, basis.currentRequest())
|
||||||
on conflict do nothing;
|
on conflict do nothing;
|
||||||
|
|
||||||
case tg_op
|
case tg_op
|
||||||
@ -125,7 +125,7 @@ begin
|
|||||||
|
|
||||||
createTriggerSQL = 'CREATE TRIGGER ' || targetTable || '_journal' ||
|
createTriggerSQL = 'CREATE TRIGGER ' || targetTable || '_journal' ||
|
||||||
' AFTER INSERT OR UPDATE OR DELETE ON ' || targetTable ||
|
' 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;
|
execute createTriggerSQL;
|
||||||
end; $$;
|
end; $$;
|
||||||
--//
|
--//
|
||||||
|
Loading…
Reference in New Issue
Block a user