[Lada-commits] [PATCH] Exclude probe/messung foreign keys in audit trail

Wald Commits scm-commit at wald.intevation.org
Fri Mar 24 12:02:12 CET 2017


# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1490353326 -3600
# Node ID d3113d59401317f520c55a19075869a5b642e280
# Parent  6fbfb8f0927a0c3350595d92e5b3defaed1ac18a
Exclude probe/messung foreign keys in audit trail.

diff -r 6fbfb8f0927a -r d3113d594013 db_schema/audit.sql
--- a/db_schema/audit.sql	Wed Mar 22 15:03:35 2017 +0100
+++ b/db_schema/audit.sql	Fri Mar 24 12:02:06 2017 +0100
@@ -89,7 +89,7 @@
             RETURN NULL;
         END IF;
     ELSIF (TG_OP = 'INSERT' AND TG_LEVEL = 'ROW') THEN
-        audit_row.row_data = row_to_json(NEW)::JSONB - excluded_cols;
+        audit_row.row_data = row_to_json(NEW)::JSONB;
         audit_row.changed_fields = jsonb_strip_nulls(row_to_json(NEW)::JSONB - excluded_cols);
     ELSE
         RAISE EXCEPTION '[land.if_modified_func] - Trigger func added as trigger for unhandled case: %, %',TG_OP, TG_LEVEL;
@@ -203,12 +203,11 @@
 
 
 SELECT audit_table('probe', true, false, '{id, tree_modified, letzte_aenderung}'::text[]);
-SELECT audit_table('messung', true, false,
-    '{id, tree_modified, letzte_aenderung, status}'::text[]);
-SELECT audit_table('messwert', true, false, '{id, tree_modified, letzte_aenderung}'::text[]);
-SELECT audit_table('kommentar_p', true, false, '{id, tree_modified, letzte_aenderung}'::text[]);
-SELECT audit_table('kommentar_m', true, false, '{id, tree_modified, letzte_aenderung}'::text[]);
-SELECT audit_table('zusatz_wert', true, false, '{id, tree_modified, letzte_aenderung}'::text[]);
-SELECT audit_table('ortszuordnung', true, false, '{id, tree_modified, letzte_aenderung}'::text[]);
+SELECT audit_table('messung', true, false, '{id, probe_id, tree_modified, letzte_aenderung, status}'::text[]);
+SELECT audit_table('messwert', true, false, '{id, messungs_id, tree_modified, letzte_aenderung}'::text[]);
+SELECT audit_table('kommentar_p', true, false, '{id, probe_id, tree_modified, letzte_aenderung}'::text[]);
+SELECT audit_table('kommentar_m', true, false, '{id, messungs_id, tree_modified, letzte_aenderung}'::text[]);
+SELECT audit_table('zusatz_wert', true, false, '{id, probe_id, tree_modified, letzte_aenderung}'::text[]);
+SELECT audit_table('ortszuordnung', true, false, '{id, probe_id, tree_modified, letzte_aenderung}'::text[]);
 
 SET search_path TO public;


More information about the Lada-commits mailing list