tx_journal: on delete also save the old data in json format (#207)
Reviewed-on: https://dev.hostsharing.net/hostsharing/hs.hsadmin.ng/pulls/207 Reviewed-by: Peter Hormanns <peter.hormanns@hostsharing.net>
This commit is contained in:
@@ -146,11 +146,12 @@ begin
|
|||||||
values (curTxId, tableSchemaAndName,
|
values (curTxId, tableSchemaAndName,
|
||||||
old.uuid, tg_op::base.tx_operation,
|
old.uuid, tg_op::base.tx_operation,
|
||||||
base.jsonb_changes_delta(to_jsonb(old), to_jsonb(new)));
|
base.jsonb_changes_delta(to_jsonb(old), to_jsonb(new)));
|
||||||
|
-- TODO.test: Auditlog testen
|
||||||
when 'DELETE' then insert
|
when 'DELETE' then insert
|
||||||
into base.tx_journal
|
into base.tx_journal
|
||||||
values (curTxId,tableSchemaAndName,
|
values (curTxId,tableSchemaAndName,
|
||||||
old.uuid, 'DELETE'::base.tx_operation,
|
old.uuid, 'DELETE'::base.tx_operation,
|
||||||
null::jsonb);
|
to_jsonb(old));
|
||||||
else raise exception 'Trigger op % not supported for %.', tg_op, tableSchemaAndName;
|
else raise exception 'Trigger op % not supported for %.', tg_op, tableSchemaAndName;
|
||||||
end case;
|
end case;
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user