BP-816, change postgres scripts for oracle
diff --git a/oKBereitschaftsplanungBackend/src/main/java/org/eclipse/openk/sp/db/config/DbInitializer.java b/oKBereitschaftsplanungBackend/src/main/java/org/eclipse/openk/sp/db/config/DbInitializer.java
index 384fda3..3a23b17 100644
--- a/oKBereitschaftsplanungBackend/src/main/java/org/eclipse/openk/sp/db/config/DbInitializer.java
+++ b/oKBereitschaftsplanungBackend/src/main/java/org/eclipse/openk/sp/db/config/DbInitializer.java
@@ -73,7 +73,7 @@
// run "delete from" script
this.loopOverSqlFiles(property.getProperty(SQL_SCRIPT_DELETE_KEY).split(","));
// run "hist" script
- // this.loopOverSqlFiles(property.getProperty(SQL_SCRIPT_HIST_KEY).split(","));
+ this.loopOverSqlFiles(property.getProperty(SQL_SCRIPT_HIST_KEY).split(","));
// run "init" script
this.loopOverSqlFiles(property.getProperty(SQL_SCRIPT_INIT_KEY).split(","));
diff --git a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/oracle/hist/BER_Trigger.sql b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/oracle/hist/BER_Trigger.sql
new file mode 100644
index 0000000..25d8ac4
--- /dev/null
+++ b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/oracle/hist/BER_Trigger.sql
@@ -0,0 +1 @@
+CREATE OR REPLACE PROCEDURE create_table_if_doesnt_exist(p_table_name VARCHAR2, create_table_query VARCHAR2) AUTHID CURRENT_USER IS n NUMBER; BEGIN SELECT COUNT(*) INTO n FROM user_tables WHERE table_name = UPPER(p_table_name); IF (n = 0) THEN EXECUTE IMMEDIATE create_table_query; END IF; END;
\ No newline at end of file
diff --git a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/oracle/hist/BER_hist_address.sql b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/oracle/hist/BER_hist_address.sql
index ad326f9..d23f5b3 100644
--- a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/oracle/hist/BER_hist_address.sql
+++ b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/oracle/hist/BER_hist_address.sql
@@ -1,24 +1,10 @@
/*Address History*/
-CREATE TABLE IF NOT EXISTS ADDRESS_HIST (HIST_ID serial, operation char(1), stamp timestamp, LIKE ADDRESS EXCLUDING ALL);
-
-CREATE OR REPLACE FUNCTION process_address_audit() RETURNS TRIGGER AS $object_audit$
- BEGIN
- --
- -- Create a row in {0}.address_hist_audit to reflect the operation performed on address,
- -- making use of the special variable TG_OP to work out the operation.
- --
- IF (TG_OP = 'DELETE') THEN
- INSERT INTO {0}.address_hist SELECT nextval('address_hist_hist_id_seq'), 'D', now(), OLD.*;
- ELSIF (TG_OP = 'UPDATE') THEN
- INSERT INTO {0}.address_hist SELECT nextval('address_hist_hist_id_seq'), 'U', now(), NEW.*;
- ELSIF (TG_OP = 'INSERT') THEN
- INSERT INTO {0}.address_hist SELECT nextval('address_hist_hist_id_seq'), 'I', now(), NEW.*;
- END IF;
- RETURN NULL; -- result is ignored since this is an AFTER trigger
- END;
-$object_audit$ LANGUAGE plpgsql;
-
+call create_table_if_doesnt_exist('OPENK.ADDRESS_HIST', 'CREATE TABLE OPENK.ADDRESS_HIST AS (SELECT * FROM OPENK.ADDRESS)');
+DELETE FROM OPENK.ADDRESS_HIST;
+DROP sequence OPENK.ADDRESS_HIST_SEQ_ID;
+CREATE sequence OPENK.ADDRESS_HIST_SEQ_ID increment by 1;
+ALTER TABLE OPENK.ADDRESS_HIST ADD(HIST_ID number(19,0) GENERATED BY DEFAULT ON NULL AS IDENTITY, operation char(1), stamp timestamp);
+ALTER TABLE OPENK.ADDRESS_HIST ADD CONSTRAINT PK_ADDRESS_HIST PRIMARY KEY (HIST_ID);
+CREATE OR REPLACE FUNCTION process_address_audit() RETURNS TRIGGER AS $object_audit$ BEGIN IF (TG_OP = 'DELETE') THEN INSERT INTO {0}.address_hist SELECT nextval('address_hist_hist_id_seq'), 'D', now(), OLD.*; ELSIF (TG_OP = 'UPDATE') THEN INSERT INTO {0}.address_hist SELECT nextval('address_hist_hist_id_seq'), 'U', now(), NEW.*; ELSIF (TG_OP = 'INSERT') THEN INSERT INTO {0}.address_hist SELECT nextval('address_hist_hist_id_seq'), 'I', now(), NEW.*; END IF; RETURN NULL; END; $object_audit$ LANGUAGE plpgsql;
DROP TRIGGER IF EXISTS address_audit on {0}.address;
-CREATE TRIGGER address_audit
-AFTER INSERT OR UPDATE OR DELETE ON {0}.address
- FOR EACH ROW EXECUTE PROCEDURE process_address_audit();
\ No newline at end of file
+CREATE TRIGGER address_audit AFTER INSERT OR UPDATE OR DELETE ON {0}.address FOR EACH ROW EXECUTE PROCEDURE process_address_audit();
\ No newline at end of file
diff --git a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/oracle/hist/BER_hist_branch.sql b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/oracle/hist/BER_hist_branch.sql
index 3d4bdc2..9bcd097 100644
--- a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/oracle/hist/BER_hist_branch.sql
+++ b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/oracle/hist/BER_hist_branch.sql
@@ -1,24 +1,10 @@
/*Branch History*/
-CREATE TABLE IF NOT EXISTS BRANCH_HIST (HIST_ID serial, operation char(1), stamp timestamp, LIKE BRANCH EXCLUDING ALL);
-
-CREATE OR REPLACE FUNCTION process_branch_audit() RETURNS TRIGGER AS $object_audit$
- BEGIN
- --
- -- Create a row in public.branch_hist_audit to reflect the operation performed on branch,
- -- making use of the special variable TG_OP to work out the operation.
- --
- IF (TG_OP = 'DELETE') THEN
- INSERT INTO public.branch_hist SELECT nextval('branch_hist_hist_id_seq'), 'D', now(), OLD.*;
- ELSIF (TG_OP = 'UPDATE') THEN
- INSERT INTO public.branch_hist SELECT nextval('branch_hist_hist_id_seq'), 'U', now(), NEW.*;
- ELSIF (TG_OP = 'INSERT') THEN
- INSERT INTO public.branch_hist SELECT nextval('branch_hist_hist_id_seq'), 'I', now(), NEW.*;
- END IF;
- RETURN NULL; -- result is ignored since this is an AFTER trigger
- END;
-$object_audit$ LANGUAGE plpgsql;
-
-DROP TRIGGER IF EXISTS branch_audit on public.branch;
-CREATE TRIGGER branch_audit
-AFTER INSERT OR UPDATE OR DELETE ON public.branch
- FOR EACH ROW EXECUTE PROCEDURE process_branch_audit();
\ No newline at end of file
+call create_table_if_doesnt_exist('OPENK.BRACNH_HIST', 'CREATE TABLE OPENK.BRANCH_HIST AS (SELECT * FROM OPENK.BRACNH)');
+DELETE FROM OPENK.BRANCH_HIST;
+DROP sequence OPENK.BRACNH_HIST_SEQ_ID;
+CREATE sequence OPENK.BRANCH_HIST_SEQ_ID increment by 1;
+ALTER TABLE OPENK.BRANCH_HIST ADD(HIST_ID number(19,0) GENERATED BY DEFAULT ON NULL AS IDENTITY, operation char(1), stamp timestamp);
+ALTER TABLE OPENK.BRANCH_HIST ADD CONSTRAINT PK_BRANCH_HIST PRIMARY KEY (HIST_ID);
+CREATE OR REPLACE FUNCTION process_branch_audit() RETURNS TRIGGER AS $object_audit$ BEGIN IF (TG_OP = 'DELETE') THEN INSERT INTO {0}.branch_hist SELECT nextval('branch_hist_hist_id_seq'), 'D', now(), OLD.*; ELSIF (TG_OP = 'UPDATE') THEN INSERT INTO {0}.branch_hist SELECT nextval('branch_hist_hist_id_seq'), 'U', now(), NEW.*; ELSIF (TG_OP = 'INSERT') THEN INSERT INTO {0}.branch_hist SELECT nextval('branch_hist_hist_id_seq'), 'I', now(), NEW.*; END IF; RETURN NULL; END; $object_audit$ LANGUAGE plpgsql;
+DROP TRIGGER IF EXISTS branch_audit on {0}.branch;
+CREATE TRIGGER branch_audit AFTER INSERT OR UPDATE OR DELETE ON {0}.branch FOR EACH ROW EXECUTE PROCEDURE process_branch_audit();
\ No newline at end of file
diff --git a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_Trigger.sql b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_Trigger.sql
new file mode 100644
index 0000000..4a77396
--- /dev/null
+++ b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_Trigger.sql
@@ -0,0 +1 @@
+--No Trigger needed for postgres
\ No newline at end of file
diff --git a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_address.sql b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_address.sql
index ad326f9..bcf4612 100644
--- a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_address.sql
+++ b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_address.sql
@@ -1,24 +1,9 @@
/*Address History*/
CREATE TABLE IF NOT EXISTS ADDRESS_HIST (HIST_ID serial, operation char(1), stamp timestamp, LIKE ADDRESS EXCLUDING ALL);
-
-CREATE OR REPLACE FUNCTION process_address_audit() RETURNS TRIGGER AS $object_audit$
- BEGIN
- --
- -- Create a row in {0}.address_hist_audit to reflect the operation performed on address,
- -- making use of the special variable TG_OP to work out the operation.
- --
- IF (TG_OP = 'DELETE') THEN
- INSERT INTO {0}.address_hist SELECT nextval('address_hist_hist_id_seq'), 'D', now(), OLD.*;
- ELSIF (TG_OP = 'UPDATE') THEN
- INSERT INTO {0}.address_hist SELECT nextval('address_hist_hist_id_seq'), 'U', now(), NEW.*;
- ELSIF (TG_OP = 'INSERT') THEN
- INSERT INTO {0}.address_hist SELECT nextval('address_hist_hist_id_seq'), 'I', now(), NEW.*;
- END IF;
- RETURN NULL; -- result is ignored since this is an AFTER trigger
- END;
-$object_audit$ LANGUAGE plpgsql;
-
+--
+-- Create a row in {0}.address_hist_audit to reflect the operation performed on address,
+-- making use of the special variable TG_OP to work out the operation.
+--
+CREATE OR REPLACE FUNCTION process_address_audit() RETURNS TRIGGER AS $object_audit$ BEGIN IF (TG_OP = 'DELETE') THEN INSERT INTO {0}.address_hist SELECT nextval('address_hist_hist_id_seq'), 'D', now(), OLD.*; ELSIF (TG_OP = 'UPDATE') THEN INSERT INTO {0}.address_hist SELECT nextval('address_hist_hist_id_seq'), 'U', now(), NEW.*; ELSIF (TG_OP = 'INSERT') THEN INSERT INTO {0}.address_hist SELECT nextval('address_hist_hist_id_seq'), 'I', now(), NEW.*; END IF; RETURN NULL; END; $object_audit$ LANGUAGE plpgsql;
DROP TRIGGER IF EXISTS address_audit on {0}.address;
-CREATE TRIGGER address_audit
-AFTER INSERT OR UPDATE OR DELETE ON {0}.address
- FOR EACH ROW EXECUTE PROCEDURE process_address_audit();
\ No newline at end of file
+CREATE TRIGGER address_audit AFTER INSERT OR UPDATE OR DELETE ON {0}.address FOR EACH ROW EXECUTE PROCEDURE process_address_audit();
\ No newline at end of file
diff --git a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_branch.sql b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_branch.sql
index 3d4bdc2..c7088fb 100644
--- a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_branch.sql
+++ b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_branch.sql
@@ -1,24 +1,9 @@
/*Branch History*/
CREATE TABLE IF NOT EXISTS BRANCH_HIST (HIST_ID serial, operation char(1), stamp timestamp, LIKE BRANCH EXCLUDING ALL);
-
-CREATE OR REPLACE FUNCTION process_branch_audit() RETURNS TRIGGER AS $object_audit$
- BEGIN
- --
- -- Create a row in public.branch_hist_audit to reflect the operation performed on branch,
- -- making use of the special variable TG_OP to work out the operation.
- --
- IF (TG_OP = 'DELETE') THEN
- INSERT INTO public.branch_hist SELECT nextval('branch_hist_hist_id_seq'), 'D', now(), OLD.*;
- ELSIF (TG_OP = 'UPDATE') THEN
- INSERT INTO public.branch_hist SELECT nextval('branch_hist_hist_id_seq'), 'U', now(), NEW.*;
- ELSIF (TG_OP = 'INSERT') THEN
- INSERT INTO public.branch_hist SELECT nextval('branch_hist_hist_id_seq'), 'I', now(), NEW.*;
- END IF;
- RETURN NULL; -- result is ignored since this is an AFTER trigger
- END;
-$object_audit$ LANGUAGE plpgsql;
-
-DROP TRIGGER IF EXISTS branch_audit on public.branch;
-CREATE TRIGGER branch_audit
-AFTER INSERT OR UPDATE OR DELETE ON public.branch
- FOR EACH ROW EXECUTE PROCEDURE process_branch_audit();
\ No newline at end of file
+--
+-- Create a row in {0}.branch_hist_audit to reflect the operation performed on branch,
+-- making use of the special variable TG_OP to work out the operation.
+--
+CREATE OR REPLACE FUNCTION process_branch_audit() RETURNS TRIGGER AS $object_audit$ BEGIN IF (TG_OP = 'DELETE') THEN INSERT INTO {0}.branch_hist SELECT nextval('branch_hist_hist_id_seq'), 'D', now(), OLD.*; ELSIF (TG_OP = 'UPDATE') THEN INSERT INTO {0}.branch_hist SELECT nextval('branch_hist_hist_id_seq'), 'U', now(), NEW.*; ELSIF (TG_OP = 'INSERT') THEN INSERT INTO {0}.branch_hist SELECT nextval('branch_hist_hist_id_seq'), 'I', now(), NEW.*; END IF; RETURN NULL; END; $object_audit$ LANGUAGE plpgsql;
+DROP TRIGGER IF EXISTS branch_audit on {0}.branch;
+CREATE TRIGGER branch_audit AFTER INSERT OR UPDATE OR DELETE ON {0}.branch FOR EACH ROW EXECUTE PROCEDURE process_branch_audit();
\ No newline at end of file
diff --git a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_calendar.sql b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_calendar.sql
index d852547..42c5ddd 100644
--- a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_calendar.sql
+++ b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_calendar.sql
@@ -1,24 +1,9 @@
/*Calendar History*/
CREATE TABLE IF NOT EXISTS CALENDAR_HIST (HIST_ID serial, operation char(1), stamp timestamp, LIKE CALENDAR EXCLUDING ALL);
-
-CREATE OR REPLACE FUNCTION process_calendar_audit() RETURNS TRIGGER AS $object_audit$
- BEGIN
- --
- -- Create a row in public.calendar_hist_audit to reflect the operation performed on calendar,
- -- making use of the special variable TG_OP to work out the operation.
- --
- IF (TG_OP = 'DELETE') THEN
- INSERT INTO public.calendar_hist SELECT nextval('calendar_hist_hist_id_seq'), 'D', now(), OLD.*;
- ELSIF (TG_OP = 'UPDATE') THEN
- INSERT INTO public.calendar_hist SELECT nextval('calendar_hist_hist_id_seq'), 'U', now(), NEW.*;
- ELSIF (TG_OP = 'INSERT') THEN
- INSERT INTO public.calendar_hist SELECT nextval('calendar_hist_hist_id_seq'), 'I', now(), NEW.*;
- END IF;
- RETURN NULL; -- result is ignored since this is an AFTER trigger
- END;
-$object_audit$ LANGUAGE plpgsql;
-
-DROP TRIGGER IF EXISTS calendar_audit on public.calendar;
-CREATE TRIGGER calendar_audit
-AFTER INSERT OR UPDATE OR DELETE ON public.calendar
- FOR EACH ROW EXECUTE PROCEDURE process_calendar_audit();
\ No newline at end of file
+--
+-- Create a row in {0}.calendar_hist_audit to reflect the operation performed on calendar,
+-- making use of the special variable TG_OP to work out the operation.
+--
+CREATE OR REPLACE FUNCTION process_calendar_audit() RETURNS TRIGGER AS $object_audit$ BEGIN IF (TG_OP = 'DELETE') THEN INSERT INTO {0}.calendar_hist SELECT nextval('calendar_hist_hist_id_seq'), 'D', now(), OLD.*; ELSIF (TG_OP = 'UPDATE') THEN INSERT INTO {0}.calendar_hist SELECT nextval('calendar_hist_hist_id_seq'), 'U', now(), NEW.*; ELSIF (TG_OP = 'INSERT') THEN INSERT INTO {0}.calendar_hist SELECT nextval('calendar_hist_hist_id_seq'), 'I', now(), NEW.*; END IF; RETURN NULL; END; $object_audit$ LANGUAGE plpgsql;
+DROP TRIGGER IF EXISTS calendar_audit on {0}.calendar;
+CREATE TRIGGER calendar_audit AFTER INSERT OR UPDATE OR DELETE ON {0}.calendar FOR EACH ROW EXECUTE PROCEDURE process_calendar_audit();
\ No newline at end of file
diff --git a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_contact_data.sql b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_contact_data.sql
index c18a9a9..b7baff4 100644
--- a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_contact_data.sql
+++ b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_contact_data.sql
@@ -1,24 +1,9 @@
/*ContactData History*/
CREATE TABLE IF NOT EXISTS CONTACT_DATA_HIST (HIST_ID serial, operation char(1), stamp timestamp, LIKE CONTACT_DATA EXCLUDING ALL);
-
-CREATE OR REPLACE FUNCTION process_contact_data_audit() RETURNS TRIGGER AS $object_audit$
- BEGIN
- --
- -- Create a row in public.contact_data_hist_audit to reflect the operation performed on contact_data,
- -- making use of the special variable TG_OP to work out the operation.
- --
- IF (TG_OP = 'DELETE') THEN
- INSERT INTO public.contact_data_hist SELECT nextval('contact_data_hist_hist_id_seq'), 'D', now(), OLD.*;
- ELSIF (TG_OP = 'UPDATE') THEN
- INSERT INTO public.contact_data_hist SELECT nextval('contact_data_hist_hist_id_seq'), 'U', now(), NEW.*;
- ELSIF (TG_OP = 'INSERT') THEN
- INSERT INTO public.contact_data_hist SELECT nextval('contact_data_hist_hist_id_seq'), 'I', now(), NEW.*;
- END IF;
- RETURN NULL; -- result is ignored since this is an AFTER trigger
- END;
-$object_audit$ LANGUAGE plpgsql;
-
-DROP TRIGGER IF EXISTS contact_data_audit on public.contact_data;
-CREATE TRIGGER contact_data_audit
-AFTER INSERT OR UPDATE OR DELETE ON public.contact_data
- FOR EACH ROW EXECUTE PROCEDURE process_contact_data_audit();
\ No newline at end of file
+--
+-- Create a row in {0}.contact_data_hist_audit to reflect the operation performed on contact_data,
+-- making use of the special variable TG_OP to work out the operation.
+--
+CREATE OR REPLACE FUNCTION process_contact_data_audit() RETURNS TRIGGER AS $object_audit$ BEGIN IF (TG_OP = 'DELETE') THEN INSERT INTO {0}.contact_data_hist SELECT nextval('contact_data_hist_hist_id_seq'), 'D', now(), OLD.*; ELSIF (TG_OP = 'UPDATE') THEN INSERT INTO {0}.contact_data_hist SELECT nextval('contact_data_hist_hist_id_seq'), 'U', now(), NEW.*; ELSIF (TG_OP = 'INSERT') THEN INSERT INTO {0}.contact_data_hist SELECT nextval('contact_data_hist_hist_id_seq'), 'I', now(), NEW.*; END IF; RETURN NULL; END; $object_audit$ LANGUAGE plpgsql;
+DROP TRIGGER IF EXISTS contact_data_audit on {0}.contact_data;
+CREATE TRIGGER contact_data_audit AFTER INSERT OR UPDATE OR DELETE ON {0}.contact_data FOR EACH ROW EXECUTE PROCEDURE process_contact_data_audit();
\ No newline at end of file
diff --git a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_int_branches_for_groups.sql b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_int_branches_for_groups.sql
index 7b04ed7..ed0a2ae 100644
--- a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_int_branches_for_groups.sql
+++ b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_int_branches_for_groups.sql
@@ -1,24 +1,9 @@
-/*Int_branches_for_groups History*/
+/*Int_branchs_for_groups History*/
CREATE TABLE IF NOT EXISTS INT_BRANCHES_FOR_GROUPS_HIST (HIST_ID serial, operation char(1), stamp timestamp, LIKE INT_BRANCHES_FOR_GROUPS EXCLUDING ALL);
-
-CREATE OR REPLACE FUNCTION process_int_branches_for_groups_audit() RETURNS TRIGGER AS $object_audit$
- BEGIN
- --
- -- Create a row in public.int_branches_for_groups_hist_audit to reflect the operation performed on int_branches_for_groups,
- -- making use of the special variable TG_OP to work out the operation.
- --
- IF (TG_OP = 'DELETE') THEN
- INSERT INTO public.int_branches_for_groups_hist SELECT nextval('int_branches_for_groups_hist_hist_id_seq'), 'D', now(), OLD.*;
- ELSIF (TG_OP = 'UPDATE') THEN
- INSERT INTO public.int_branches_for_groups_hist SELECT nextval('int_branches_for_groups_hist_hist_id_seq'), 'U', now(), NEW.*;
- ELSIF (TG_OP = 'INSERT') THEN
- INSERT INTO public.int_branches_for_groups_hist SELECT nextval('int_branches_for_groups_hist_hist_id_seq'), 'I', now(), NEW.*;
- END IF;
- RETURN NULL; -- result is ignored since this is an AFTER trigger
- END;
-$object_audit$ LANGUAGE plpgsql;
-
-DROP TRIGGER IF EXISTS int_branches_for_groups_audit on public.int_branches_for_groups;
-CREATE TRIGGER int_branches_for_groups_audit
-AFTER INSERT OR UPDATE OR DELETE ON public.int_branches_for_groups
- FOR EACH ROW EXECUTE PROCEDURE process_int_branches_for_groups_audit();
\ No newline at end of file
+--
+-- Create a row in {0}.int_branches_for_groups_hist_audit to reflect the operation performed on int_branches_for_groups,
+-- making use of the special variable TG_OP to work out the operation.
+--
+CREATE OR REPLACE FUNCTION process_int_branches_for_groups_audit() RETURNS TRIGGER AS $object_audit$ BEGIN IF (TG_OP = 'DELETE') THEN INSERT INTO {0}.int_branches_for_groups_hist SELECT nextval('int_branches_for_groups_hist_hist_id_seq'), 'D', now(), OLD.*; ELSIF (TG_OP = 'UPDATE') THEN INSERT INTO {0}.int_branches_for_groups_hist SELECT nextval('int_branches_for_groups_hist_hist_id_seq'), 'U', now(), NEW.*; ELSIF (TG_OP = 'INSERT') THEN INSERT INTO {0}.int_branches_for_groups_hist SELECT nextval('int_branches_for_groups_hist_hist_id_seq'), 'I', now(), NEW.*; END IF; RETURN NULL; END; $object_audit$ LANGUAGE plpgsql;
+DROP TRIGGER IF EXISTS int_branches_for_groups_audit on {0}.int_branches_for_groups;
+CREATE TRIGGER int_branches_for_groups_audit AFTER INSERT OR UPDATE OR DELETE ON {0}.int_branches_for_groups FOR EACH ROW EXECUTE PROCEDURE process_int_branches_for_groups_audit();
\ No newline at end of file
diff --git a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_int_groups_in_list.sql b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_int_groups_in_list.sql
index b54845e..aba1792 100644
--- a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_int_groups_in_list.sql
+++ b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_int_groups_in_list.sql
@@ -1,24 +1,10 @@
-/*Int_groups_in_list History*/
-CREATE TABLE IF NOT EXISTS INT_GROUPS_IN_LIST_HIST (HIST_ID serial, operation char(1), stamp timestamp, LIKE INT_GROUPS_IN_LIST EXCLUDING ALL);
-
-CREATE OR REPLACE FUNCTION process_int_groups_in_list_audit() RETURNS TRIGGER AS $object_audit$
- BEGIN
- --
- -- Create a row in public.int_groups_in_list_hist_audit to reflect the operation performed on int_groups_in_list,
- -- making use of the special variable TG_OP to work out the operation.
- --
- IF (TG_OP = 'DELETE') THEN
- INSERT INTO public.int_groups_in_list_hist SELECT nextval('int_groups_in_list_hist_hist_id_seq'), 'D', now(), OLD.*;
- ELSIF (TG_OP = 'UPDATE') THEN
- INSERT INTO public.int_groups_in_list_hist SELECT nextval('int_groups_in_list_hist_hist_id_seq'), 'U', now(), NEW.*;
- ELSIF (TG_OP = 'INSERT') THEN
- INSERT INTO public.int_groups_in_list_hist SELECT nextval('int_groups_in_list_hist_hist_id_seq'), 'I', now(), NEW.*;
- END IF;
- RETURN NULL; -- result is ignored since this is an AFTER trigger
- END;
-$object_audit$ LANGUAGE plpgsql;
-
-DROP TRIGGER IF EXISTS int_groups_in_list_audit on public.int_groups_in_list;
-CREATE TRIGGER int_groups_in_list_audit
-AFTER INSERT OR UPDATE OR DELETE ON public.int_groups_in_list
- FOR EACH ROW EXECUTE PROCEDURE process_int_groups_in_list_audit();
\ No newline at end of file
+/*Int_standby_list_has_standby_group History*/
+/*Address History*/
+CREATE TABLE IF NOT EXISTS STANDBY_LIST_HAS_STANDBY_GROUP_HIST (HIST_ID serial, operation char(1), stamp timestamp, LIKE STANDBY_LIST_HAS_STANDBY_GROUP EXCLUDING ALL);
+--
+-- Create a row in {0}.standby_list_has_standby_group_hist_audit to reflect the operation performed on standby_list_has_standby_group,
+-- making use of the special variable TG_OP to work out the operation.
+--
+CREATE OR REPLACE FUNCTION process_standby_list_has_standby_group_audit() RETURNS TRIGGER AS $object_audit$ BEGIN IF (TG_OP = 'DELETE') THEN INSERT INTO {0}.standby_list_has_standby_group_hist SELECT nextval('standby_list_has_standby_group_hist_hist_id_seq'), 'D', now(), OLD.*; ELSIF (TG_OP = 'UPDATE') THEN INSERT INTO {0}.standby_list_has_standby_group_hist SELECT nextval('standby_list_has_standby_group_hist_hist_id_seq'), 'U', now(), NEW.*; ELSIF (TG_OP = 'INSERT') THEN INSERT INTO {0}.standby_list_has_standby_group_hist SELECT nextval('standby_list_has_standby_group_hist_hist_id_seq'), 'I', now(), NEW.*; END IF; RETURN NULL; END; $object_audit$ LANGUAGE plpgsql;
+DROP TRIGGER IF EXISTS standby_list_has_standby_group_audit on {0}.standby_list_has_standby_group;
+CREATE TRIGGER standby_list_has_standby_group_audit AFTER INSERT OR UPDATE OR DELETE ON {0}.standby_list_has_standby_group FOR EACH ROW EXECUTE PROCEDURE process_standby_list_has_standby_group_audit();
\ No newline at end of file
diff --git a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_int_location_has_postcode.sql b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_int_location_has_postcode.sql
index 4feec03..27c31df 100644
--- a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_int_location_has_postcode.sql
+++ b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_int_location_has_postcode.sql
@@ -1,24 +1,9 @@
-/*Int_location_has_postcode History*/
+/*Int_int_location_has_postcode History*/
CREATE TABLE IF NOT EXISTS INT_LOCATION_HAS_POSTCODE_HIST (HIST_ID serial, operation char(1), stamp timestamp, LIKE INT_LOCATION_HAS_POSTCODE EXCLUDING ALL);
-
-CREATE OR REPLACE FUNCTION process_int_location_has_postcode_audit() RETURNS TRIGGER AS $object_audit$
- BEGIN
- --
- -- Create a row in public.int_location_has_postcode_hist_audit to reflect the operation performed on int_location_has_postcode,
- -- making use of the special variable TG_OP to work out the operation.
- --
- IF (TG_OP = 'DELETE') THEN
- INSERT INTO public.int_location_has_postcode_hist SELECT nextval('int_location_has_postcode_hist_hist_id_seq'), 'D', now(), OLD.*;
- ELSIF (TG_OP = 'UPDATE') THEN
- INSERT INTO public.int_location_has_postcode_hist SELECT nextval('int_location_has_postcode_hist_hist_id_seq'), 'U', now(), NEW.*;
- ELSIF (TG_OP = 'INSERT') THEN
- INSERT INTO public.int_location_has_postcode_hist SELECT nextval('int_location_has_postcode_hist_hist_id_seq'), 'I', now(), NEW.*;
- END IF;
- RETURN NULL; -- result is ignored since this is an AFTER trigger
- END;
-$object_audit$ LANGUAGE plpgsql;
-
-DROP TRIGGER IF EXISTS int_location_has_postcode_audit on public.int_location_has_postcode;
-CREATE TRIGGER int_location_has_postcode_audit
-AFTER INSERT OR UPDATE OR DELETE ON public.int_location_has_postcode
- FOR EACH ROW EXECUTE PROCEDURE process_int_location_has_postcode_audit();
\ No newline at end of file
+--
+-- Create a row in {0}.int_location_has_postcode_hist_audit to reflect the operation performed on int_location_has_postcode,
+-- making use of the special variable TG_OP to work out the operation.
+--
+CREATE OR REPLACE FUNCTION process_int_location_has_postcode_audit() RETURNS TRIGGER AS $object_audit$ BEGIN IF (TG_OP = 'DELETE') THEN INSERT INTO {0}.int_location_has_postcode_hist SELECT nextval('int_location_has_postcode_hist_hist_id_seq'), 'D', now(), OLD.*; ELSIF (TG_OP = 'UPDATE') THEN INSERT INTO {0}.int_location_has_postcode_hist SELECT nextval('int_location_has_postcode_hist_hist_id_seq'), 'U', now(), NEW.*; ELSIF (TG_OP = 'INSERT') THEN INSERT INTO {0}.int_location_has_postcode_hist SELECT nextval('int_location_has_postcode_hist_hist_id_seq'), 'I', now(), NEW.*; END IF; RETURN NULL; END; $object_audit$ LANGUAGE plpgsql;
+DROP TRIGGER IF EXISTS int_location_has_postcode_audit on {0}.int_location_has_postcode;
+CREATE TRIGGER int_location_has_postcode_audit AFTER INSERT OR UPDATE OR DELETE ON {0}.int_location_has_postcode FOR EACH ROW EXECUTE PROCEDURE process_int_location_has_postcode_audit();
\ No newline at end of file
diff --git a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_int_regions_in_location.sql b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_int_regions_in_location.sql
index 1d68197..048f1f8 100644
--- a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_int_regions_in_location.sql
+++ b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_int_regions_in_location.sql
@@ -1,24 +1,10 @@
-/*Int_regions_in_location History*/
+/*Int_int_regions_in_location History*/
+/*Address History*/
CREATE TABLE IF NOT EXISTS INT_REGIONS_IN_LOCATION_HIST (HIST_ID serial, operation char(1), stamp timestamp, LIKE INT_REGIONS_IN_LOCATION EXCLUDING ALL);
-
-CREATE OR REPLACE FUNCTION process_int_regions_in_location_audit() RETURNS TRIGGER AS $object_audit$
- BEGIN
- --
- -- Create a row in public.int_regions_in_location_hist_audit to reflect the operation performed on int_regions_in_location,
- -- making use of the special variable TG_OP to work out the operation.
- --
- IF (TG_OP = 'DELETE') THEN
- INSERT INTO public.int_regions_in_location_hist SELECT nextval('int_regions_in_location_hist_hist_id_seq'), 'D', now(), OLD.*;
- ELSIF (TG_OP = 'UPDATE') THEN
- INSERT INTO public.int_regions_in_location_hist SELECT nextval('int_regions_in_location_hist_hist_id_seq'), 'U', now(), NEW.*;
- ELSIF (TG_OP = 'INSERT') THEN
- INSERT INTO public.int_regions_in_location_hist SELECT nextval('int_regions_in_location_hist_hist_id_seq'), 'I', now(), NEW.*;
- END IF;
- RETURN NULL; -- result is ignored since this is an AFTER trigger
- END;
-$object_audit$ LANGUAGE plpgsql;
-
-DROP TRIGGER IF EXISTS int_regions_in_location_audit on public.int_regions_in_location;
-CREATE TRIGGER int_regions_in_location_audit
-AFTER INSERT OR UPDATE OR DELETE ON public.int_regions_in_location
- FOR EACH ROW EXECUTE PROCEDURE process_int_regions_in_location_audit();
\ No newline at end of file
+--
+-- Create a row in {0}.int_int_regions_in_location_hist_audit to reflect the operation performed on int_regions_in_location,
+-- making use of the special variable TG_OP to work out the operation.
+--
+CREATE OR REPLACE FUNCTION process_int_regions_in_location_audit() RETURNS TRIGGER AS $object_audit$ BEGIN IF (TG_OP = 'DELETE') THEN INSERT INTO {0}.int_regions_in_location_hist SELECT nextval('int_regions_in_location_hist_hist_id_seq'), 'D', now(), OLD.*; ELSIF (TG_OP = 'UPDATE') THEN INSERT INTO {0}.int_regions_in_location_hist SELECT nextval('int_regions_in_location_hist_hist_id_seq'), 'U', now(), NEW.*; ELSIF (TG_OP = 'INSERT') THEN INSERT INTO {0}.int_regions_in_location_hist SELECT nextval('int_regions_in_location_hist_hist_id_seq'), 'I', now(), NEW.*; END IF; RETURN NULL; END; $object_audit$ LANGUAGE plpgsql;
+DROP TRIGGER IF EXISTS int_regions_in_location_audit on {0}.int_regions_in_location;
+CREATE TRIGGER int_regions_in_location_audit AFTER INSERT OR UPDATE OR DELETE ON {0}.int_regions_in_location FOR EACH ROW EXECUTE PROCEDURE process_int_regions_in_location_audit();
\ No newline at end of file
diff --git a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_int_standbygroup_has_function.sql b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_int_standbygroup_has_function.sql
index 6751144..c8bb3e6 100644
--- a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_int_standbygroup_has_function.sql
+++ b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_int_standbygroup_has_function.sql
@@ -1,24 +1,9 @@
/*int_standbygroup_has_function History*/
CREATE TABLE IF NOT EXISTS INT_STANDBYGROUP_HAS_FUNCTION_HIST (HIST_ID serial, operation char(1), stamp timestamp, LIKE INT_STANDBYGROUP_HAS_FUNCTION EXCLUDING ALL);
-
-CREATE OR REPLACE FUNCTION process_int_standbygroup_has_function_audit() RETURNS TRIGGER AS $object_audit$
- BEGIN
- --
- -- Create a row in public.int_standbygroup_has_function_hist_audit to reflect the operation performed on int_standbygroup_has_function,
- -- making use of the special variable TG_OP to work out the operation.
- --
- IF (TG_OP = 'DELETE') THEN
- INSERT INTO public.int_standbygroup_has_function_hist SELECT nextval('int_standbygroup_has_function_hist_hist_id_seq'), 'D', now(), OLD.*;
- ELSIF (TG_OP = 'UPDATE') THEN
- INSERT INTO public.int_standbygroup_has_function_hist SELECT nextval('int_standbygroup_has_function_hist_hist_id_seq'), 'U', now(), NEW.*;
- ELSIF (TG_OP = 'INSERT') THEN
- INSERT INTO public.int_standbygroup_has_function_hist SELECT nextval('int_standbygroup_has_function_hist_hist_id_seq'), 'I', now(), NEW.*;
- END IF;
- RETURN NULL; -- result is ignored since this is an AFTER trigger
- END;
-$object_audit$ LANGUAGE plpgsql;
-
-DROP TRIGGER IF EXISTS int_standbygroup_has_function_audit on public.int_standbygroup_has_function;
-CREATE TRIGGER int_standbygroup_has_function_audit
-AFTER INSERT OR UPDATE OR DELETE ON public.int_standbygroup_has_function
- FOR EACH ROW EXECUTE PROCEDURE process_int_standbygroup_has_function_audit();
\ No newline at end of file
+--
+-- Create a row in {0}.int_standbygroup_has_function_hist_audit to reflect the operation performed on int_standbygroup_has_function,
+-- making use of the special variable TG_OP to work out the operation.
+--
+CREATE OR REPLACE FUNCTION process_int_standbygroup_has_function_audit() RETURNS TRIGGER AS $object_audit$ BEGIN IF (TG_OP = 'DELETE') THEN INSERT INTO {0}.int_standbygroup_has_function_hist SELECT nextval('int_standbygroup_has_function_hist_hist_id_seq'), 'D', now(), OLD.*; ELSIF (TG_OP = 'UPDATE') THEN INSERT INTO {0}.int_standbygroup_has_function_hist SELECT nextval('int_standbygroup_has_function_hist_hist_id_seq'), 'U', now(), NEW.*; ELSIF (TG_OP = 'INSERT') THEN INSERT INTO {0}.int_standbygroup_has_function_hist SELECT nextval('int_standbygroup_has_function_hist_hist_id_seq'), 'I', now(), NEW.*; END IF; RETURN NULL; END; $object_audit$ LANGUAGE plpgsql;
+DROP TRIGGER IF EXISTS int_standbygroup_has_function_audit on {0}.int_standbygroup_has_function;
+CREATE TRIGGER int_standbygroup_has_function_audit AFTER INSERT OR UPDATE OR DELETE ON {0}.int_standbygroup_has_function FOR EACH ROW EXECUTE PROCEDURE process_int_standbygroup_has_function_audit();
\ No newline at end of file
diff --git a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_location.sql b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_location.sql
index c54fee2..d4f2c4b 100644
--- a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_location.sql
+++ b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_location.sql
@@ -1,24 +1,9 @@
-/*Location History*/
+/*Branch History*/
CREATE TABLE IF NOT EXISTS LOCATION_HIST (HIST_ID serial, operation char(1), stamp timestamp, LIKE LOCATION EXCLUDING ALL);
-
-CREATE OR REPLACE FUNCTION process_location_audit() RETURNS TRIGGER AS $object_audit$
- BEGIN
- --
- -- Create a row in public.location_hist_audit to reflect the operation performed on location,
- -- making use of the special variable TG_OP to work out the operation.
- --
- IF (TG_OP = 'DELETE') THEN
- INSERT INTO public.location_hist SELECT nextval('location_hist_hist_id_seq'), 'D', now(), OLD.*;
- ELSIF (TG_OP = 'UPDATE') THEN
- INSERT INTO public.location_hist SELECT nextval('location_hist_hist_id_seq'), 'U', now(), NEW.*;
- ELSIF (TG_OP = 'INSERT') THEN
- INSERT INTO public.location_hist SELECT nextval('location_hist_hist_id_seq'), 'I', now(), NEW.*;
- END IF;
- RETURN NULL; -- result is ignored since this is an AFTER trigger
- END;
-$object_audit$ LANGUAGE plpgsql;
-
-DROP TRIGGER IF EXISTS location_audit on public.location;
-CREATE TRIGGER location_audit
-AFTER INSERT OR UPDATE OR DELETE ON public.location
- FOR EACH ROW EXECUTE PROCEDURE process_location_audit();
\ No newline at end of file
+--
+-- Create a row in {0}.location_hist_audit to reflect the operation performed on location,
+-- making use of the special variable TG_OP to work out the operation.
+--
+CREATE OR REPLACE FUNCTION process_location_audit() RETURNS TRIGGER AS $object_audit$ BEGIN IF (TG_OP = 'DELETE') THEN INSERT INTO {0}.location_hist SELECT nextval('location_hist_hist_id_seq'), 'D', now(), OLD.*; ELSIF (TG_OP = 'UPDATE') THEN INSERT INTO {0}.location_hist SELECT nextval('location_hist_hist_id_seq'), 'U', now(), NEW.*; ELSIF (TG_OP = 'INSERT') THEN INSERT INTO {0}.location_hist SELECT nextval('location_hist_hist_id_seq'), 'I', now(), NEW.*; END IF; RETURN NULL; END; $object_audit$ LANGUAGE plpgsql;
+DROP TRIGGER IF EXISTS location_audit on {0}.location;
+CREATE TRIGGER location_audit AFTER INSERT OR UPDATE OR DELETE ON {0}.location FOR EACH ROW EXECUTE PROCEDURE process_location_audit();
\ No newline at end of file
diff --git a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_location_for_branch.sql b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_location_for_branch.sql
index 5a2d5d1..804d66d 100644
--- a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_location_for_branch.sql
+++ b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_location_for_branch.sql
@@ -1,24 +1,9 @@
-/*Location_for_branch History*/
+/*Branch History*/
CREATE TABLE IF NOT EXISTS LOCATION_FOR_BRANCH_HIST (HIST_ID serial, operation char(1), stamp timestamp, LIKE LOCATION_FOR_BRANCH EXCLUDING ALL);
-
-CREATE OR REPLACE FUNCTION process_location_for_branch_audit() RETURNS TRIGGER AS $object_audit$
- BEGIN
- --
- -- Create a row in public.location_for_branch_hist_audit to reflect the operation performed on location_for_branch,
- -- making use of the special variable TG_OP to work out the operation.
- --
- IF (TG_OP = 'DELETE') THEN
- INSERT INTO public.location_for_branch_hist SELECT nextval('location_for_branch_hist_hist_id_seq'), 'D', now(), OLD.*;
- ELSIF (TG_OP = 'UPDATE') THEN
- INSERT INTO public.location_for_branch_hist SELECT nextval('location_for_branch_hist_hist_id_seq'), 'U', now(), NEW.*;
- ELSIF (TG_OP = 'INSERT') THEN
- INSERT INTO public.location_for_branch_hist SELECT nextval('location_for_branch_hist_hist_id_seq'), 'I', now(), NEW.*;
- END IF;
- RETURN NULL; -- result is ignored since this is an AFTER trigger
- END;
-$object_audit$ LANGUAGE plpgsql;
-
-DROP TRIGGER IF EXISTS location_for_branch_audit on public.location_for_branch;
-CREATE TRIGGER location_for_branch_audit
-AFTER INSERT OR UPDATE OR DELETE ON public.location_for_branch
- FOR EACH ROW EXECUTE PROCEDURE process_location_for_branch_audit();
\ No newline at end of file
+--
+-- Create a row in {0}.location_for_branch_hist_audit to reflect the operation performed on location_for_branch,
+-- making use of the special variable TG_OP to work out the operation.
+--
+CREATE OR REPLACE FUNCTION process_location_for_branch_audit() RETURNS TRIGGER AS $object_audit$ BEGIN IF (TG_OP = 'DELETE') THEN INSERT INTO {0}.location_for_branch_hist SELECT nextval('location_for_branch_hist_hist_id_seq'), 'D', now(), OLD.*; ELSIF (TG_OP = 'UPDATE') THEN INSERT INTO {0}.location_for_branch_hist SELECT nextval('location_for_branch_hist_hist_id_seq'), 'U', now(), NEW.*; ELSIF (TG_OP = 'INSERT') THEN INSERT INTO {0}.location_for_branch_hist SELECT nextval('location_for_branch_hist_hist_id_seq'), 'I', now(), NEW.*; END IF; RETURN NULL; END; $object_audit$ LANGUAGE plpgsql;
+DROP TRIGGER IF EXISTS location_for_branch_audit on {0}.location_for_branch;
+CREATE TRIGGER location_for_branch_audit AFTER INSERT OR UPDATE OR DELETE ON {0}.location_for_branch FOR EACH ROW EXECUTE PROCEDURE process_location_for_branch_audit();
\ No newline at end of file
diff --git a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_organisation.sql b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_organisation.sql
index 8d94ee4..d7dc029 100644
--- a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_organisation.sql
+++ b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_organisation.sql
@@ -1,24 +1,9 @@
-/*Organisation History*/
+/*organisation History*/
CREATE TABLE IF NOT EXISTS ORGANISATION_HIST (HIST_ID serial, operation char(1), stamp timestamp, LIKE ORGANISATION EXCLUDING ALL);
-
-CREATE OR REPLACE FUNCTION process_organisation_audit() RETURNS TRIGGER AS $object_audit$
- BEGIN
- --
- -- Create a row in public.organisation_hist_audit to reflect the operation performed on organisation,
- -- making use of the special variable TG_OP to work out the operation.
- --
- IF (TG_OP = 'DELETE') THEN
- INSERT INTO public.organisation_hist SELECT nextval('organisation_hist_hist_id_seq'), 'D', now(), OLD.*;
- ELSIF (TG_OP = 'UPDATE') THEN
- INSERT INTO public.organisation_hist SELECT nextval('organisation_hist_hist_id_seq'), 'U', now(), NEW.*;
- ELSIF (TG_OP = 'INSERT') THEN
- INSERT INTO public.organisation_hist SELECT nextval('organisation_hist_hist_id_seq'), 'I', now(), NEW.*;
- END IF;
- RETURN NULL; -- result is ignored since this is an AFTER trigger
- END;
-$object_audit$ LANGUAGE plpgsql;
-
-DROP TRIGGER IF EXISTS organisation_audit on public.organisation;
-CREATE TRIGGER organisation_audit
-AFTER INSERT OR UPDATE OR DELETE ON public.organisation
- FOR EACH ROW EXECUTE PROCEDURE process_organisation_audit();
\ No newline at end of file
+--
+-- Create a row in {0}.organisation_hist_audit to reflect the operation performed on organisation,
+-- making use of the special variable TG_OP to work out the operation.
+--
+CREATE OR REPLACE FUNCTION process_organisation_audit() RETURNS TRIGGER AS $object_audit$ BEGIN IF (TG_OP = 'DELETE') THEN INSERT INTO {0}.organisation_hist SELECT nextval('organisation_hist_hist_id_seq'), 'D', now(), OLD.*; ELSIF (TG_OP = 'UPDATE') THEN INSERT INTO {0}.organisation_hist SELECT nextval('organisation_hist_hist_id_seq'), 'U', now(), NEW.*; ELSIF (TG_OP = 'INSERT') THEN INSERT INTO {0}.organisation_hist SELECT nextval('organisation_hist_hist_id_seq'), 'I', now(), NEW.*; END IF; RETURN NULL; END; $object_audit$ LANGUAGE plpgsql;
+DROP TRIGGER IF EXISTS organisation_audit on {0}.organisation;
+CREATE TRIGGER organisation_audit AFTER INSERT OR UPDATE OR DELETE ON {0}.organisation FOR EACH ROW EXECUTE PROCEDURE process_organisation_audit();
\ No newline at end of file
diff --git a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_postcode.sql b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_postcode.sql
index d8385a9..c88781b 100644
--- a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_postcode.sql
+++ b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_postcode.sql
@@ -1,24 +1,9 @@
-/*Postcode History*/
+/*postcode History*/
CREATE TABLE IF NOT EXISTS POSTCODE_HIST (HIST_ID serial, operation char(1), stamp timestamp, LIKE POSTCODE EXCLUDING ALL);
-
-CREATE OR REPLACE FUNCTION process_postcode_audit() RETURNS TRIGGER AS $object_audit$
- BEGIN
- --
- -- Create a row in public.postcode_hist_audit to reflect the operation performed on postcode,
- -- making use of the special variable TG_OP to work out the operation.
- --
- IF (TG_OP = 'DELETE') THEN
- INSERT INTO public.postcode_hist SELECT nextval('postcode_hist_hist_id_seq'), 'D', now(), OLD.*;
- ELSIF (TG_OP = 'UPDATE') THEN
- INSERT INTO public.postcode_hist SELECT nextval('postcode_hist_hist_id_seq'), 'U', now(), NEW.*;
- ELSIF (TG_OP = 'INSERT') THEN
- INSERT INTO public.postcode_hist SELECT nextval('postcode_hist_hist_id_seq'), 'I', now(), NEW.*;
- END IF;
- RETURN NULL; -- result is ignored since this is an AFTER trigger
- END;
-$object_audit$ LANGUAGE plpgsql;
-
-DROP TRIGGER IF EXISTS postcode_audit on public.postcode;
-CREATE TRIGGER postcode_audit
-AFTER INSERT OR UPDATE OR DELETE ON public.postcode
- FOR EACH ROW EXECUTE PROCEDURE process_postcode_audit();
\ No newline at end of file
+--
+-- Create a row in {0}.postcode_hist_audit to reflect the operation performed on postcode,
+-- making use of the special variable TG_OP to work out the operation.
+--
+CREATE OR REPLACE FUNCTION process_postcode_audit() RETURNS TRIGGER AS $object_audit$ BEGIN IF (TG_OP = 'DELETE') THEN INSERT INTO {0}.postcode_hist SELECT nextval('postcode_hist_hist_id_seq'), 'D', now(), OLD.*; ELSIF (TG_OP = 'UPDATE') THEN INSERT INTO {0}.postcode_hist SELECT nextval('postcode_hist_hist_id_seq'), 'U', now(), NEW.*; ELSIF (TG_OP = 'INSERT') THEN INSERT INTO {0}.postcode_hist SELECT nextval('postcode_hist_hist_id_seq'), 'I', now(), NEW.*; END IF; RETURN NULL; END; $object_audit$ LANGUAGE plpgsql;
+DROP TRIGGER IF EXISTS postcode_audit on {0}.postcode;
+CREATE TRIGGER postcode_audit AFTER INSERT OR UPDATE OR DELETE ON {0}.postcode FOR EACH ROW EXECUTE PROCEDURE process_postcode_audit();
\ No newline at end of file
diff --git a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_region.sql b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_region.sql
index c9752d5..c366ee3 100644
--- a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_region.sql
+++ b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_region.sql
@@ -1,24 +1,9 @@
/*Region History*/
CREATE TABLE IF NOT EXISTS REGION_HIST (HIST_ID serial, operation char(1), stamp timestamp, LIKE REGION EXCLUDING ALL);
-
-CREATE OR REPLACE FUNCTION process_region_audit() RETURNS TRIGGER AS $object_audit$
- BEGIN
- --
- -- Create a row in public.region_hist_audit to reflect the operation performed on region,
- -- making use of the special variable TG_OP to work out the operation.
- --
- IF (TG_OP = 'DELETE') THEN
- INSERT INTO public.region_hist SELECT nextval('region_hist_hist_id_seq'), 'D', now(), OLD.*;
- ELSIF (TG_OP = 'UPDATE') THEN
- INSERT INTO public.region_hist SELECT nextval('region_hist_hist_id_seq'), 'U', now(), NEW.*;
- ELSIF (TG_OP = 'INSERT') THEN
- INSERT INTO public.region_hist SELECT nextval('region_hist_hist_id_seq'), 'I', now(), NEW.*;
- END IF;
- RETURN NULL; -- result is ignored since this is an AFTER trigger
- END;
-$object_audit$ LANGUAGE plpgsql;
-
-DROP TRIGGER IF EXISTS region_audit on public.region;
-CREATE TRIGGER region_audit
-AFTER INSERT OR UPDATE OR DELETE ON public.region
- FOR EACH ROW EXECUTE PROCEDURE process_region_audit();
\ No newline at end of file
+--
+-- Create a row in {0}.region_hist_audit to reflect the operation performed on region,
+-- making use of the special variable TG_OP to work out the operation.
+--
+CREATE OR REPLACE FUNCTION process_region_audit() RETURNS TRIGGER AS $object_audit$ BEGIN IF (TG_OP = 'DELETE') THEN INSERT INTO {0}.region_hist SELECT nextval('region_hist_hist_id_seq'), 'D', now(), OLD.*; ELSIF (TG_OP = 'UPDATE') THEN INSERT INTO {0}.region_hist SELECT nextval('region_hist_hist_id_seq'), 'U', now(), NEW.*; ELSIF (TG_OP = 'INSERT') THEN INSERT INTO {0}.region_hist SELECT nextval('region_hist_hist_id_seq'), 'I', now(), NEW.*; END IF; RETURN NULL; END; $object_audit$ LANGUAGE plpgsql;
+DROP TRIGGER IF EXISTS region_audit on {0}.region;
+CREATE TRIGGER region_audit AFTER INSERT OR UPDATE OR DELETE ON {0}.region FOR EACH ROW EXECUTE PROCEDURE process_region_audit();
\ No newline at end of file
diff --git a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_standby_duration.sql b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_standby_duration.sql
index cb57a30..98203f7 100644
--- a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_standby_duration.sql
+++ b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_standby_duration.sql
@@ -1,24 +1,9 @@
-/*Standby_duration History*/
+/*Standby Duration History*/
CREATE TABLE IF NOT EXISTS STANDBY_DURATION_HIST (HIST_ID serial, operation char(1), stamp timestamp, LIKE STANDBY_DURATION EXCLUDING ALL);
-
-CREATE OR REPLACE FUNCTION process_standby_duration_audit() RETURNS TRIGGER AS $object_audit$
- BEGIN
- --
- -- Create a row in public.standby_duration_hist_audit to reflect the operation performed on standby_duration,
- -- making use of the special variable TG_OP to work out the operation.
- --
- IF (TG_OP = 'DELETE') THEN
- INSERT INTO public.standby_duration_hist SELECT nextval('standby_duration_hist_hist_id_seq'), 'D', now(), OLD.*;
- ELSIF (TG_OP = 'UPDATE') THEN
- INSERT INTO public.standby_duration_hist SELECT nextval('standby_duration_hist_hist_id_seq'), 'U', now(), NEW.*;
- ELSIF (TG_OP = 'INSERT') THEN
- INSERT INTO public.standby_duration_hist SELECT nextval('standby_duration_hist_hist_id_seq'), 'I', now(), NEW.*;
- END IF;
- RETURN NULL; -- result is ignored since this is an AFTER trigger
- END;
-$object_audit$ LANGUAGE plpgsql;
-
-DROP TRIGGER IF EXISTS standby_duration_audit on public.standby_duration;
-CREATE TRIGGER standby_duration_audit
-AFTER INSERT OR UPDATE OR DELETE ON public.standby_duration
- FOR EACH ROW EXECUTE PROCEDURE process_standby_duration_audit();
\ No newline at end of file
+--
+-- Create a row in {0}.standby_duration_hist_audit to reflect the operation performed on standby_duration,
+-- making use of the special variable TG_OP to work out the operation.
+--
+CREATE OR REPLACE FUNCTION process_standby_duration_audit() RETURNS TRIGGER AS $object_audit$ BEGIN IF (TG_OP = 'DELETE') THEN INSERT INTO {0}.standby_duration_hist SELECT nextval('standby_duration_hist_hist_id_seq'), 'D', now(), OLD.*; ELSIF (TG_OP = 'UPDATE') THEN INSERT INTO {0}.standby_duration_hist SELECT nextval('standby_duration_hist_hist_id_seq'), 'U', now(), NEW.*; ELSIF (TG_OP = 'INSERT') THEN INSERT INTO {0}.standby_duration_hist SELECT nextval('standby_duration_hist_hist_id_seq'), 'I', now(), NEW.*; END IF; RETURN NULL; END; $object_audit$ LANGUAGE plpgsql;
+DROP TRIGGER IF EXISTS standby_duration_audit on {0}.standby_duration;
+CREATE TRIGGER standby_duration_audit AFTER INSERT OR UPDATE OR DELETE ON {0}.standby_duration FOR EACH ROW EXECUTE PROCEDURE process_standby_duration_audit();
\ No newline at end of file
diff --git a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_standby_group.sql b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_standby_group.sql
index 1bb8ac0..4ba987a 100644
--- a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_standby_group.sql
+++ b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_standby_group.sql
@@ -1,24 +1,9 @@
-/*Standby_group History*/
+/*Standby Group History*/
CREATE TABLE IF NOT EXISTS STANDBY_GROUP_HIST (HIST_ID serial, operation char(1), stamp timestamp, LIKE STANDBY_GROUP EXCLUDING ALL);
-
-CREATE OR REPLACE FUNCTION process_standby_group_audit() RETURNS TRIGGER AS $object_audit$
- BEGIN
- --
- -- Create a row in public.standby_group_hist_audit to reflect the operation performed on standby_group,
- -- making use of the special variable TG_OP to work out the operation.
- --
- IF (TG_OP = 'DELETE') THEN
- INSERT INTO public.standby_group_hist SELECT nextval('standby_group_hist_hist_id_seq'), 'D', now(), OLD.*;
- ELSIF (TG_OP = 'UPDATE') THEN
- INSERT INTO public.standby_group_hist SELECT nextval('standby_group_hist_hist_id_seq'), 'U', now(), NEW.*;
- ELSIF (TG_OP = 'INSERT') THEN
- INSERT INTO public.standby_group_hist SELECT nextval('standby_group_hist_hist_id_seq'), 'I', now(), NEW.*;
- END IF;
- RETURN NULL; -- result is ignored since this is an AFTER trigger
- END;
-$object_audit$ LANGUAGE plpgsql;
-
-DROP TRIGGER IF EXISTS standby_group_audit on public.standby_group;
-CREATE TRIGGER standby_group_audit
-AFTER INSERT OR UPDATE OR DELETE ON public.standby_group
- FOR EACH ROW EXECUTE PROCEDURE process_standby_group_audit();
\ No newline at end of file
+--
+-- Create a row in {0}.standby_group_hist_audit to reflect the operation performed on standby_group,
+-- making use of the special variable TG_OP to work out the operation.
+--
+CREATE OR REPLACE FUNCTION process_standby_group_audit() RETURNS TRIGGER AS $object_audit$ BEGIN IF (TG_OP = 'DELETE') THEN INSERT INTO {0}.standby_group_hist SELECT nextval('standby_group_hist_hist_id_seq'), 'D', now(), OLD.*; ELSIF (TG_OP = 'UPDATE') THEN INSERT INTO {0}.standby_group_hist SELECT nextval('standby_group_hist_hist_id_seq'), 'U', now(), NEW.*; ELSIF (TG_OP = 'INSERT') THEN INSERT INTO {0}.standby_group_hist SELECT nextval('standby_group_hist_hist_id_seq'), 'I', now(), NEW.*; END IF; RETURN NULL; END; $object_audit$ LANGUAGE plpgsql;
+DROP TRIGGER IF EXISTS standby_group_audit on {0}.standby_group;
+CREATE TRIGGER standby_group_audit AFTER INSERT OR UPDATE OR DELETE ON {0}.standby_group FOR EACH ROW EXECUTE PROCEDURE process_standby_group_audit();
\ No newline at end of file
diff --git a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_standby_list.sql b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_standby_list.sql
index 257983e..15517bd 100644
--- a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_standby_list.sql
+++ b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_standby_list.sql
@@ -1,24 +1,9 @@
-/*Standby_list History*/
+/*Standby List History*/
CREATE TABLE IF NOT EXISTS STANDBY_LIST_HIST (HIST_ID serial, operation char(1), stamp timestamp, LIKE STANDBY_LIST EXCLUDING ALL);
-
-CREATE OR REPLACE FUNCTION process_standby_list_audit() RETURNS TRIGGER AS $object_audit$
- BEGIN
- --
- -- Create a row in public.standby_list_hist_audit to reflect the operation performed on standby_list,
- -- making use of the special variable TG_OP to work out the operation.
- --
- IF (TG_OP = 'DELETE') THEN
- INSERT INTO public.standby_list_hist SELECT nextval('standby_list_hist_hist_id_seq'), 'D', now(), OLD.*;
- ELSIF (TG_OP = 'UPDATE') THEN
- INSERT INTO public.standby_list_hist SELECT nextval('standby_list_hist_hist_id_seq'), 'U', now(), NEW.*;
- ELSIF (TG_OP = 'INSERT') THEN
- INSERT INTO public.standby_list_hist SELECT nextval('standby_list_hist_hist_id_seq'), 'I', now(), NEW.*;
- END IF;
- RETURN NULL; -- result is ignored since this is an AFTER trigger
- END;
-$object_audit$ LANGUAGE plpgsql;
-
-DROP TRIGGER IF EXISTS standby_list_audit on public.standby_list;
-CREATE TRIGGER standby_list_audit
-AFTER INSERT OR UPDATE OR DELETE ON public.standby_list
- FOR EACH ROW EXECUTE PROCEDURE process_standby_list_audit();
\ No newline at end of file
+--
+-- Create a row in {0}.standby_list_hist_audit to reflect the operation performed on standby_list,
+-- making use of the special variable TG_OP to work out the operation.
+--
+CREATE OR REPLACE FUNCTION process_standby_list_audit() RETURNS TRIGGER AS $object_audit$ BEGIN IF (TG_OP = 'DELETE') THEN INSERT INTO {0}.standby_list_hist SELECT nextval('standby_list_hist_hist_id_seq'), 'D', now(), OLD.*; ELSIF (TG_OP = 'UPDATE') THEN INSERT INTO {0}.standby_list_hist SELECT nextval('standby_list_hist_hist_id_seq'), 'U', now(), NEW.*; ELSIF (TG_OP = 'INSERT') THEN INSERT INTO {0}.standby_list_hist SELECT nextval('standby_list_hist_hist_id_seq'), 'I', now(), NEW.*; END IF; RETURN NULL; END; $object_audit$ LANGUAGE plpgsql;
+DROP TRIGGER IF EXISTS standby_list_audit on {0}.standby_list;
+CREATE TRIGGER standby_list_audit AFTER INSERT OR UPDATE OR DELETE ON {0}.standby_list FOR EACH ROW EXECUTE PROCEDURE process_standby_list_audit();
\ No newline at end of file
diff --git a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_standby_planning_status.sql b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_standby_planning_status.sql
index 0b0a4d8..f32e496 100644
--- a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_standby_planning_status.sql
+++ b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_standby_planning_status.sql
@@ -1,24 +1,9 @@
/*Standby_planning_status History*/
CREATE TABLE IF NOT EXISTS STANDBY_PLANNING_STATUS_HIST (HIST_ID serial, operation char(1), stamp timestamp, LIKE STANDBY_PLANNING_STATUS EXCLUDING ALL);
-
-CREATE OR REPLACE FUNCTION process_standby_planning_status_audit() RETURNS TRIGGER AS $object_audit$
- BEGIN
- --
- -- Create a row in public.standby_planning_status_hist_audit to reflect the operation performed on standby_planning_status,
- -- making use of the special variable TG_OP to work out the operation.
- --
- IF (TG_OP = 'DELETE') THEN
- INSERT INTO public.standby_planning_status_hist SELECT nextval('standby_planning_status_hist_hist_id_seq'), 'D', now(), OLD.*;
- ELSIF (TG_OP = 'UPDATE') THEN
- INSERT INTO public.standby_planning_status_hist SELECT nextval('standby_planning_status_hist_hist_id_seq'), 'U', now(), NEW.*;
- ELSIF (TG_OP = 'INSERT') THEN
- INSERT INTO public.standby_planning_status_hist SELECT nextval('standby_planning_status_hist_hist_id_seq'), 'I', now(), NEW.*;
- END IF;
- RETURN NULL; -- result is ignored since this is an AFTER trigger
- END;
-$object_audit$ LANGUAGE plpgsql;
-
-DROP TRIGGER IF EXISTS standby_planning_status_audit on public.standby_planning_status;
-CREATE TRIGGER standby_planning_status_audit
-AFTER INSERT OR UPDATE OR DELETE ON public.standby_planning_status
- FOR EACH ROW EXECUTE PROCEDURE process_standby_planning_status_audit();
\ No newline at end of file
+--
+-- Create a row in {0}.standby_planning_status_hist_audit to reflect the operation performed on standby_planning_status,
+-- making use of the special variable TG_OP to work out the operation.
+--
+CREATE OR REPLACE FUNCTION process_standby_planning_status_audit() RETURNS TRIGGER AS $object_audit$ BEGIN IF (TG_OP = 'DELETE') THEN INSERT INTO {0}.standby_planning_status_hist SELECT nextval('standby_planning_status_hist_hist_id_seq'), 'D', now(), OLD.*; ELSIF (TG_OP = 'UPDATE') THEN INSERT INTO {0}.standby_planning_status_hist SELECT nextval('standby_planning_status_hist_hist_id_seq'), 'U', now(), NEW.*; ELSIF (TG_OP = 'INSERT') THEN INSERT INTO {0}.standby_planning_status_hist SELECT nextval('standby_planning_status_hist_hist_id_seq'), 'I', now(), NEW.*; END IF; RETURN NULL; END; $object_audit$ LANGUAGE plpgsql;
+DROP TRIGGER IF EXISTS standby_planning_status_audit on {0}.standby_planning_status;
+CREATE TRIGGER standby_planning_status_audit AFTER INSERT OR UPDATE OR DELETE ON {0}.standby_planning_status FOR EACH ROW EXECUTE PROCEDURE process_standby_planning_status_audit();
\ No newline at end of file
diff --git a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_standby_schedule_body.sql b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_standby_schedule_body.sql
index 3b2ffc2..1c0a174 100644
--- a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_standby_schedule_body.sql
+++ b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_standby_schedule_body.sql
@@ -1,24 +1,9 @@
/*Standby_schedule_body History*/
CREATE TABLE IF NOT EXISTS STANDBY_SCHEDULE_BODY_HIST (HIST_ID serial, operation char(1), stamp timestamp, LIKE STANDBY_SCHEDULE_BODY EXCLUDING ALL);
-
-CREATE OR REPLACE FUNCTION process_standby_schedule_body_audit() RETURNS TRIGGER AS $object_audit$
- BEGIN
- --
- -- Create a row in public.standby_schedule_body_hist_audit to reflect the operation performed on standby_schedule_body,
- -- making use of the special variable TG_OP to work out the operation.
- --
- IF (TG_OP = 'DELETE') THEN
- INSERT INTO public.standby_schedule_body_hist SELECT nextval('standby_schedule_body_hist_hist_id_seq'), 'D', now(), OLD.*;
- ELSIF (TG_OP = 'UPDATE') THEN
- INSERT INTO public.standby_schedule_body_hist SELECT nextval('standby_schedule_body_hist_hist_id_seq'), 'U', now(), NEW.*;
- ELSIF (TG_OP = 'INSERT') THEN
- INSERT INTO public.standby_schedule_body_hist SELECT nextval('standby_schedule_body_hist_hist_id_seq'), 'I', now(), NEW.*;
- END IF;
- RETURN NULL; -- result is ignored since this is an AFTER trigger
- END;
-$object_audit$ LANGUAGE plpgsql;
-
-DROP TRIGGER IF EXISTS standby_schedule_body_audit on public.standby_schedule_body;
-CREATE TRIGGER standby_schedule_body_audit
-AFTER INSERT OR UPDATE OR DELETE ON public.standby_schedule_body
- FOR EACH ROW EXECUTE PROCEDURE process_standby_schedule_body_audit();
\ No newline at end of file
+--
+-- Create a row in {0}.standby_schedule_body_hist_audit to reflect the operation performed on standby_schedule_body,
+-- making use of the special variable TG_OP to work out the operation.
+--
+CREATE OR REPLACE FUNCTION process_standby_schedule_body_audit() RETURNS TRIGGER AS $object_audit$ BEGIN IF (TG_OP = 'DELETE') THEN INSERT INTO {0}.standby_schedule_body_hist SELECT nextval('standby_schedule_body_hist_hist_id_seq'), 'D', now(), OLD.*; ELSIF (TG_OP = 'UPDATE') THEN INSERT INTO {0}.standby_schedule_body_hist SELECT nextval('standby_schedule_body_hist_hist_id_seq'), 'U', now(), NEW.*; ELSIF (TG_OP = 'INSERT') THEN INSERT INTO {0}.standby_schedule_body_hist SELECT nextval('standby_schedule_body_hist_hist_id_seq'), 'I', now(), NEW.*; END IF; RETURN NULL; END; $object_audit$ LANGUAGE plpgsql;
+DROP TRIGGER IF EXISTS standby_schedule_body_audit on {0}.standby_schedule_body;
+CREATE TRIGGER standby_schedule_body_audit AFTER INSERT OR UPDATE OR DELETE ON {0}.standby_schedule_body FOR EACH ROW EXECUTE PROCEDURE process_standby_schedule_body_audit();
\ No newline at end of file
diff --git a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_standby_schedule_header.sql b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_standby_schedule_header.sql
index 099f458..e750675 100644
--- a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_standby_schedule_header.sql
+++ b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_standby_schedule_header.sql
@@ -1,24 +1,9 @@
/*Standby_schedule_header History*/
CREATE TABLE IF NOT EXISTS STANDBY_SCHEDULE_HEADER_HIST (HIST_ID serial, operation char(1), stamp timestamp, LIKE STANDBY_SCHEDULE_HEADER EXCLUDING ALL);
-
-CREATE OR REPLACE FUNCTION process_standby_schedule_header_audit() RETURNS TRIGGER AS $object_audit$
- BEGIN
- --
- -- Create a row in public.standby_schedule_header_hist_audit to reflect the operation performed on standby_schedule_header,
- -- making use of the special variable TG_OP to work out the operation.
- --
- IF (TG_OP = 'DELETE') THEN
- INSERT INTO public.standby_schedule_header_hist SELECT nextval('standby_schedule_header_hist_hist_id_seq'), 'D', now(), OLD.*;
- ELSIF (TG_OP = 'UPDATE') THEN
- INSERT INTO public.standby_schedule_header_hist SELECT nextval('standby_schedule_header_hist_hist_id_seq'), 'U', now(), NEW.*;
- ELSIF (TG_OP = 'INSERT') THEN
- INSERT INTO public.standby_schedule_header_hist SELECT nextval('standby_schedule_header_hist_hist_id_seq'), 'I', now(), NEW.*;
- END IF;
- RETURN NULL; -- result is ignored since this is an AFTER trigger
- END;
-$object_audit$ LANGUAGE plpgsql;
-
-DROP TRIGGER IF EXISTS standby_schedule_header_audit on public.standby_schedule_header;
-CREATE TRIGGER standby_schedule_header_audit
-AFTER INSERT OR UPDATE OR DELETE ON public.standby_schedule_header
- FOR EACH ROW EXECUTE PROCEDURE process_standby_schedule_header_audit();
\ No newline at end of file
+--
+-- Create a row in {0}.standby_schedule_header_hist_audit to reflect the operation performed on standby_schedule_header,
+-- making use of the special variable TG_OP to work out the operation.
+--
+CREATE OR REPLACE FUNCTION process_standby_schedule_header_audit() RETURNS TRIGGER AS $object_audit$ BEGIN IF (TG_OP = 'DELETE') THEN INSERT INTO {0}.standby_schedule_header_hist SELECT nextval('standby_schedule_header_hist_hist_id_seq'), 'D', now(), OLD.*; ELSIF (TG_OP = 'UPDATE') THEN INSERT INTO {0}.standby_schedule_header_hist SELECT nextval('standby_schedule_header_hist_hist_id_seq'), 'U', now(), NEW.*; ELSIF (TG_OP = 'INSERT') THEN INSERT INTO {0}.standby_schedule_header_hist SELECT nextval('standby_schedule_header_hist_hist_id_seq'), 'I', now(), NEW.*; END IF; RETURN NULL; END; $object_audit$ LANGUAGE plpgsql;
+DROP TRIGGER IF EXISTS standby_schedule_header_audit on {0}.standby_schedule_header;
+CREATE TRIGGER standby_schedule_header_audit AFTER INSERT OR UPDATE OR DELETE ON {0}.standby_schedule_header FOR EACH ROW EXECUTE PROCEDURE process_standby_schedule_header_audit();
\ No newline at end of file
diff --git a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_standby_schedule_history.sql b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_standby_schedule_history.sql
index c54fee2..02cf6c0 100644
--- a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_standby_schedule_history.sql
+++ b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_standby_schedule_history.sql
@@ -1,24 +1,9 @@
-/*Location History*/
-CREATE TABLE IF NOT EXISTS LOCATION_HIST (HIST_ID serial, operation char(1), stamp timestamp, LIKE LOCATION EXCLUDING ALL);
-
-CREATE OR REPLACE FUNCTION process_location_audit() RETURNS TRIGGER AS $object_audit$
- BEGIN
- --
- -- Create a row in public.location_hist_audit to reflect the operation performed on location,
- -- making use of the special variable TG_OP to work out the operation.
- --
- IF (TG_OP = 'DELETE') THEN
- INSERT INTO public.location_hist SELECT nextval('location_hist_hist_id_seq'), 'D', now(), OLD.*;
- ELSIF (TG_OP = 'UPDATE') THEN
- INSERT INTO public.location_hist SELECT nextval('location_hist_hist_id_seq'), 'U', now(), NEW.*;
- ELSIF (TG_OP = 'INSERT') THEN
- INSERT INTO public.location_hist SELECT nextval('location_hist_hist_id_seq'), 'I', now(), NEW.*;
- END IF;
- RETURN NULL; -- result is ignored since this is an AFTER trigger
- END;
-$object_audit$ LANGUAGE plpgsql;
-
-DROP TRIGGER IF EXISTS location_audit on public.location;
-CREATE TRIGGER location_audit
-AFTER INSERT OR UPDATE OR DELETE ON public.location
- FOR EACH ROW EXECUTE PROCEDURE process_location_audit();
\ No newline at end of file
+/*Standby Schedule History*/
+CREATE TABLE IF NOT EXISTS STANDBY_SCHEDULE_HISTORY_HIST (HIST_ID serial, operation char(1), stamp timestamp, LIKE STANDBY_SCHEDULE_HISTORY EXCLUDING ALL);
+--
+-- Create a row in {0}.standby_schedule_history_hist_audit to reflect the operation performed on standby_schedule_history,
+-- making use of the special variable TG_OP to work out the operation.
+--
+CREATE OR REPLACE FUNCTION process_standby_schedule_history_audit() RETURNS TRIGGER AS $object_audit$ BEGIN IF (TG_OP = 'DELETE') THEN INSERT INTO {0}.standby_schedule_history_hist SELECT nextval('standby_schedule_history_hist_hist_id_seq'), 'D', now(), OLD.*; ELSIF (TG_OP = 'UPDATE') THEN INSERT INTO {0}.standby_schedule_history_hist SELECT nextval('standby_schedule_history_hist_hist_id_seq'), 'U', now(), NEW.*; ELSIF (TG_OP = 'INSERT') THEN INSERT INTO {0}.standby_schedule_history_hist SELECT nextval('standby_schedule_history_hist_hist_id_seq'), 'I', now(), NEW.*; END IF; RETURN NULL; END; $object_audit$ LANGUAGE plpgsql;
+DROP TRIGGER IF EXISTS standby_schedule_history_audit on {0}.standby_schedule_history;
+CREATE TRIGGER standby_schedule_history_audit AFTER INSERT OR UPDATE OR DELETE ON {0}.standby_schedule_history FOR EACH ROW EXECUTE PROCEDURE process_standby_schedule_history_audit();
\ No newline at end of file
diff --git a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_standby_status.sql b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_standby_status.sql
index 9873415..b4625a7 100644
--- a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_standby_status.sql
+++ b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_standby_status.sql
@@ -1,24 +1,9 @@
/*Standby_status History*/
CREATE TABLE IF NOT EXISTS STANDBY_STATUS_HIST (HIST_ID serial, operation char(1), stamp timestamp, LIKE STANDBY_STATUS EXCLUDING ALL);
-
-CREATE OR REPLACE FUNCTION process_standby_status_audit() RETURNS TRIGGER AS $object_audit$
- BEGIN
- --
- -- Create a row in public.standby_status_hist_audit to reflect the operation performed on standby_status,
- -- making use of the special variable TG_OP to work out the operation.
- --
- IF (TG_OP = 'DELETE') THEN
- INSERT INTO public.standby_status_hist SELECT nextval('standby_status_hist_hist_id_seq'), 'D', now(), OLD.*;
- ELSIF (TG_OP = 'UPDATE') THEN
- INSERT INTO public.standby_status_hist SELECT nextval('standby_status_hist_hist_id_seq'), 'U', now(), NEW.*;
- ELSIF (TG_OP = 'INSERT') THEN
- INSERT INTO public.standby_status_hist SELECT nextval('standby_status_hist_hist_id_seq'), 'I', now(), NEW.*;
- END IF;
- RETURN NULL; -- result is ignored since this is an AFTER trigger
- END;
-$object_audit$ LANGUAGE plpgsql;
-
-DROP TRIGGER IF EXISTS standby_status_audit on public.standby_status;
-CREATE TRIGGER standby_status_audit
-AFTER INSERT OR UPDATE OR DELETE ON public.standby_status
- FOR EACH ROW EXECUTE PROCEDURE process_standby_status_audit();
\ No newline at end of file
+--
+-- Create a row in {0}.standby_status_hist_audit to reflect the operation performed on standby_status,
+-- making use of the special variable TG_OP to work out the operation.
+--
+CREATE OR REPLACE FUNCTION process_standby_status_audit() RETURNS TRIGGER AS $object_audit$ BEGIN IF (TG_OP = 'DELETE') THEN INSERT INTO {0}.standby_status_hist SELECT nextval('standby_status_hist_hist_id_seq'), 'D', now(), OLD.*; ELSIF (TG_OP = 'UPDATE') THEN INSERT INTO {0}.standby_status_hist SELECT nextval('standby_status_hist_hist_id_seq'), 'U', now(), NEW.*; ELSIF (TG_OP = 'INSERT') THEN INSERT INTO {0}.standby_status_hist SELECT nextval('standby_status_hist_hist_id_seq'), 'I', now(), NEW.*; END IF; RETURN NULL; END; $object_audit$ LANGUAGE plpgsql;
+DROP TRIGGER IF EXISTS standby_status_audit on {0}.standby_status;
+CREATE TRIGGER standby_status_audit AFTER INSERT OR UPDATE OR DELETE ON {0}.standby_status FOR EACH ROW EXECUTE PROCEDURE process_standby_status_audit();
\ No newline at end of file
diff --git a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_standby_user.sql b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_standby_user.sql
index 5a4c6c4..d06b153 100644
--- a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_standby_user.sql
+++ b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_standby_user.sql
@@ -1,24 +1,9 @@
/*Standby_user History*/
CREATE TABLE IF NOT EXISTS STANDBY_USER_HIST (HIST_ID serial, operation char(1), stamp timestamp, LIKE STANDBY_USER EXCLUDING ALL);
-
-CREATE OR REPLACE FUNCTION process_standby_user_audit() RETURNS TRIGGER AS $object_audit$
- BEGIN
- --
- -- Create a row in public.standby_user_hist_audit to reflect the operation performed on standby_user,
- -- making use of the special variable TG_OP to work out the operation.
- --
- IF (TG_OP = 'DELETE') THEN
- INSERT INTO public.standby_user_hist SELECT nextval('standby_user_hist_hist_id_seq'), 'D', now(), OLD.*;
- ELSIF (TG_OP = 'UPDATE') THEN
- INSERT INTO public.standby_user_hist SELECT nextval('standby_user_hist_hist_id_seq'), 'U', now(), NEW.*;
- ELSIF (TG_OP = 'INSERT') THEN
- INSERT INTO public.standby_user_hist SELECT nextval('standby_user_hist_hist_id_seq'), 'I', now(), NEW.*;
- END IF;
- RETURN NULL; -- result is ignored since this is an AFTER trigger
- END;
-$object_audit$ LANGUAGE plpgsql;
-
-DROP TRIGGER IF EXISTS standby_user_audit on public.standby_user;
-CREATE TRIGGER standby_user_audit
-AFTER INSERT OR UPDATE OR DELETE ON public.standby_user
- FOR EACH ROW EXECUTE PROCEDURE process_standby_user_audit();
\ No newline at end of file
+--
+-- Create a row in {0}.standby_user_hist_audit to reflect the operation performed on standby_user,
+-- making use of the special variable TG_OP to work out the operation.
+--
+CREATE OR REPLACE FUNCTION process_standby_user_audit() RETURNS TRIGGER AS $object_audit$ BEGIN IF (TG_OP = 'DELETE') THEN INSERT INTO {0}.standby_user_hist SELECT nextval('standby_user_hist_hist_id_seq'), 'D', now(), OLD.*; ELSIF (TG_OP = 'UPDATE') THEN INSERT INTO {0}.standby_user_hist SELECT nextval('standby_user_hist_hist_id_seq'), 'U', now(), NEW.*; ELSIF (TG_OP = 'INSERT') THEN INSERT INTO {0}.standby_user_hist SELECT nextval('standby_user_hist_hist_id_seq'), 'I', now(), NEW.*; END IF; RETURN NULL; END; $object_audit$ LANGUAGE plpgsql;
+DROP TRIGGER IF EXISTS standby_user_audit on {0}.standby_user;
+CREATE TRIGGER standby_user_audit AFTER INSERT OR UPDATE OR DELETE ON {0}.standby_user FOR EACH ROW EXECUTE PROCEDURE process_standby_user_audit();
\ No newline at end of file
diff --git a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_user_function.sql b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_user_function.sql
index c6491e4..28e4c0e 100644
--- a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_user_function.sql
+++ b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_user_function.sql
@@ -1,24 +1,9 @@
/*user_function History*/
CREATE TABLE IF NOT EXISTS USER_FUNCTION_HIST (HIST_ID serial, operation char(1), stamp timestamp, LIKE USER_FUNCTION EXCLUDING ALL);
-
-CREATE OR REPLACE FUNCTION process_user_function_audit() RETURNS TRIGGER AS $object_audit$
- BEGIN
- --
- -- Create a row in public.user_function_hist_audit to reflect the operation performed on user_function,
- -- making use of the special variable TG_OP to work out the operation.
- --
- IF (TG_OP = 'DELETE') THEN
- INSERT INTO public.user_function_hist SELECT nextval('user_function_hist_hist_id_seq'), 'D', now(), OLD.*;
- ELSIF (TG_OP = 'UPDATE') THEN
- INSERT INTO public.user_function_hist SELECT nextval('user_function_hist_hist_id_seq'), 'U', now(), NEW.*;
- ELSIF (TG_OP = 'INSERT') THEN
- INSERT INTO public.user_function_hist SELECT nextval('user_function_hist_hist_id_seq'), 'I', now(), NEW.*;
- END IF;
- RETURN NULL; -- result is ignored since this is an AFTER trigger
- END;
-$object_audit$ LANGUAGE plpgsql;
-
-DROP TRIGGER IF EXISTS user_function_audit on public.user_function;
-CREATE TRIGGER user_function_audit
-AFTER INSERT OR UPDATE OR DELETE ON public.user_function
- FOR EACH ROW EXECUTE PROCEDURE process_user_function_audit();
\ No newline at end of file
+--
+-- Create a row in {0}.user_function_hist_audit to reflect the operation performed on user_function,
+-- making use of the special variable TG_OP to work out the operation.
+--
+CREATE OR REPLACE FUNCTION process_user_function_audit() RETURNS TRIGGER AS $object_audit$ BEGIN IF (TG_OP = 'DELETE') THEN INSERT INTO {0}.user_function_hist SELECT nextval('user_function_hist_hist_id_seq'), 'D', now(), OLD.*; ELSIF (TG_OP = 'UPDATE') THEN INSERT INTO {0}.user_function_hist SELECT nextval('user_function_hist_hist_id_seq'), 'U', now(), NEW.*; ELSIF (TG_OP = 'INSERT') THEN INSERT INTO {0}.user_function_hist SELECT nextval('user_function_hist_hist_id_seq'), 'I', now(), NEW.*; END IF; RETURN NULL; END; $object_audit$ LANGUAGE plpgsql;
+DROP TRIGGER IF EXISTS user_function_audit on {0}.user_function;
+CREATE TRIGGER user_function_audit AFTER INSERT OR UPDATE OR DELETE ON {0}.user_function FOR EACH ROW EXECUTE PROCEDURE process_user_function_audit();
\ No newline at end of file
diff --git a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_user_has_user_function.sql b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_user_has_user_function.sql
index 9388c76..169c2d9 100644
--- a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_user_has_user_function.sql
+++ b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_user_has_user_function.sql
@@ -1,24 +1,9 @@
/*User_has_user_function History*/
CREATE TABLE IF NOT EXISTS USER_HAS_USER_FUNCTION_HIST (HIST_ID serial, operation char(1), stamp timestamp, LIKE USER_HAS_USER_FUNCTION EXCLUDING ALL);
-
-CREATE OR REPLACE FUNCTION process_user_has_user_function_audit() RETURNS TRIGGER AS $object_audit$
- BEGIN
- --
- -- Create a row in public.user_has_user_function_hist_audit to reflect the operation performed on user_has_user_function,
- -- making use of the special variable TG_OP to work out the operation.
- --
- IF (TG_OP = 'DELETE') THEN
- INSERT INTO public.user_has_user_function_hist SELECT nextval('user_has_user_function_hist_hist_id_seq'), 'D', now(), OLD.*;
- ELSIF (TG_OP = 'UPDATE') THEN
- INSERT INTO public.user_has_user_function_hist SELECT nextval('user_has_user_function_hist_hist_id_seq'), 'U', now(), NEW.*;
- ELSIF (TG_OP = 'INSERT') THEN
- INSERT INTO public.user_has_user_function_hist SELECT nextval('user_has_user_function_hist_hist_id_seq'), 'I', now(), NEW.*;
- END IF;
- RETURN NULL; -- result is ignored since this is an AFTER trigger
- END;
-$object_audit$ LANGUAGE plpgsql;
-
-DROP TRIGGER IF EXISTS user_has_user_function_audit on public.user_has_user_function;
-CREATE TRIGGER user_has_user_function_audit
-AFTER INSERT OR UPDATE OR DELETE ON public.user_has_user_function
- FOR EACH ROW EXECUTE PROCEDURE process_user_has_user_function_audit();
\ No newline at end of file
+--
+-- Create a row in {0}.user_has_user_function_hist_audit to reflect the operation performed on user_has_user_function,
+-- making use of the special variable TG_OP to work out the operation.
+--
+CREATE OR REPLACE FUNCTION process_user_has_user_function_audit() RETURNS TRIGGER AS $object_audit$ BEGIN IF (TG_OP = 'DELETE') THEN INSERT INTO {0}.user_has_user_function_hist SELECT nextval('user_has_user_function_hist_hist_id_seq'), 'D', now(), OLD.*; ELSIF (TG_OP = 'UPDATE') THEN INSERT INTO {0}.user_has_user_function_hist SELECT nextval('user_has_user_function_hist_hist_id_seq'), 'U', now(), NEW.*; ELSIF (TG_OP = 'INSERT') THEN INSERT INTO {0}.user_has_user_function_hist SELECT nextval('user_has_user_function_hist_hist_id_seq'), 'I', now(), NEW.*; END IF; RETURN NULL; END; $object_audit$ LANGUAGE plpgsql;
+DROP TRIGGER IF EXISTS user_has_user_function_audit on {0}.user_has_user_function;
+CREATE TRIGGER user_has_user_function_audit AFTER INSERT OR UPDATE OR DELETE ON {0}.user_has_user_function FOR EACH ROW EXECUTE PROCEDURE process_user_has_user_function_audit();
\ No newline at end of file
diff --git a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_user_in_region.sql b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_user_in_region.sql
index 3e70a6d..1116c31 100644
--- a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_user_in_region.sql
+++ b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_user_in_region.sql
@@ -1,24 +1,9 @@
/*user_in_region History*/
CREATE TABLE IF NOT EXISTS USER_IN_REGION_HIST (HIST_ID serial, operation char(1), stamp timestamp, LIKE USER_IN_REGION EXCLUDING ALL);
-
-CREATE OR REPLACE FUNCTION process_user_in_region_audit() RETURNS TRIGGER AS $object_audit$
- BEGIN
- --
- -- Create a row in public.user_in_region_hist_audit to reflect the operation performed on user_in_region,
- -- making use of the special variable TG_OP to work out the operation.
- --
- IF (TG_OP = 'DELETE') THEN
- INSERT INTO public.user_in_region_hist SELECT nextval('user_in_region_hist_hist_id_seq'), 'D', now(), OLD.*;
- ELSIF (TG_OP = 'UPDATE') THEN
- INSERT INTO public.user_in_region_hist SELECT nextval('user_in_region_hist_hist_id_seq'), 'U', now(), NEW.*;
- ELSIF (TG_OP = 'INSERT') THEN
- INSERT INTO public.user_in_region_hist SELECT nextval('user_in_region_hist_hist_id_seq'), 'I', now(), NEW.*;
- END IF;
- RETURN NULL; -- result is ignored since this is an AFTER trigger
- END;
-$object_audit$ LANGUAGE plpgsql;
-
-DROP TRIGGER IF EXISTS user_in_region_audit on public.user_in_region;
-CREATE TRIGGER user_in_region_audit
-AFTER INSERT OR UPDATE OR DELETE ON public.user_in_region
- FOR EACH ROW EXECUTE PROCEDURE process_user_in_region_audit();
\ No newline at end of file
+--
+-- Create a row in {0}.user_in_region_hist_audit to reflect the operation performed on user_in_region,
+-- making use of the special variable TG_OP to work out the operation.
+--
+CREATE OR REPLACE FUNCTION process_user_in_region_audit() RETURNS TRIGGER AS $object_audit$ BEGIN IF (TG_OP = 'DELETE') THEN INSERT INTO {0}.user_in_region_hist SELECT nextval('user_in_region_hist_hist_id_seq'), 'D', now(), OLD.*; ELSIF (TG_OP = 'UPDATE') THEN INSERT INTO {0}.user_in_region_hist SELECT nextval('user_in_region_hist_hist_id_seq'), 'U', now(), NEW.*; ELSIF (TG_OP = 'INSERT') THEN INSERT INTO {0}.user_in_region_hist SELECT nextval('user_in_region_hist_hist_id_seq'), 'I', now(), NEW.*; END IF; RETURN NULL; END; $object_audit$ LANGUAGE plpgsql;
+DROP TRIGGER IF EXISTS user_in_region_audit on {0}.user_in_region;
+CREATE TRIGGER user_in_region_audit AFTER INSERT OR UPDATE OR DELETE ON {0}.user_in_region FOR EACH ROW EXECUTE PROCEDURE process_user_in_region_audit();
\ No newline at end of file
diff --git a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_user_in_standby_group.sql b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_user_in_standby_group.sql
index 1670197..3018ed3 100644
--- a/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_user_in_standby_group.sql
+++ b/oKBereitschaftsplanungBackend/src/main/resources/META-INF/sql/postgres/hist/BER_hist_user_in_standby_group.sql
@@ -1,24 +1,9 @@
/*User_in_standby_group History*/
CREATE TABLE IF NOT EXISTS USER_IN_STANDBY_GROUP_HIST (HIST_ID serial, operation char(1), stamp timestamp, LIKE USER_IN_STANDBY_GROUP EXCLUDING ALL);
-
-CREATE OR REPLACE FUNCTION process_user_in_standby_group_audit() RETURNS TRIGGER AS $object_audit$
- BEGIN
- --
- -- Create a row in public.user_in_standby_group_hist_audit to reflect the operation performed on user_in_standby_group,
- -- making use of the special variable TG_OP to work out the operation.
- --
- IF (TG_OP = 'DELETE') THEN
- INSERT INTO public.user_in_standby_group_hist SELECT nextval('user_in_standby_group_hist_hist_id_seq'), 'D', now(), OLD.*;
- ELSIF (TG_OP = 'UPDATE') THEN
- INSERT INTO public.user_in_standby_group_hist SELECT nextval('user_in_standby_group_hist_hist_id_seq'), 'U', now(), NEW.*;
- ELSIF (TG_OP = 'INSERT') THEN
- INSERT INTO public.user_in_standby_group_hist SELECT nextval('user_in_standby_group_hist_hist_id_seq'), 'I', now(), NEW.*;
- END IF;
- RETURN NULL; -- result is ignored since this is an AFTER trigger
- END;
-$object_audit$ LANGUAGE plpgsql;
-
-DROP TRIGGER IF EXISTS user_in_standby_group_audit on public.user_in_standby_group;
-CREATE TRIGGER user_in_standby_group_audit
-AFTER INSERT OR UPDATE OR DELETE ON public.user_in_standby_group
- FOR EACH ROW EXECUTE PROCEDURE process_user_in_standby_group_audit();
\ No newline at end of file
+--
+-- Create a row in {0}.user_in_standby_group_hist_audit to reflect the operation performed on user_in_standby_group,
+-- making use of the special variable TG_OP to work out the operation.
+--
+CREATE OR REPLACE FUNCTION process_user_in_standby_group_audit() RETURNS TRIGGER AS $object_audit$ BEGIN IF (TG_OP = 'DELETE') THEN INSERT INTO {0}.user_in_standby_group_hist SELECT nextval('user_in_standby_group_hist_hist_id_seq'), 'D', now(), OLD.*; ELSIF (TG_OP = 'UPDATE') THEN INSERT INTO {0}.user_in_standby_group_hist SELECT nextval('user_in_standby_group_hist_hist_id_seq'), 'U', now(), NEW.*; ELSIF (TG_OP = 'INSERT') THEN INSERT INTO {0}.user_in_standby_group_hist SELECT nextval('user_in_standby_group_hist_hist_id_seq'), 'I', now(), NEW.*; END IF; RETURN NULL; END; $object_audit$ LANGUAGE plpgsql;
+DROP TRIGGER IF EXISTS user_in_standby_group_audit on {0}.user_in_standby_group;
+CREATE TRIGGER user_in_standby_group_audit AFTER INSERT OR UPDATE OR DELETE ON {0}.user_in_standby_group FOR EACH ROW EXECUTE PROCEDURE process_user_in_standby_group_audit();
\ No newline at end of file
diff --git a/oKBereitschaftsplanungBackend/src/main/resources/application.properties b/oKBereitschaftsplanungBackend/src/main/resources/application.properties
index dcf10d3..dd25e7c 100644
--- a/oKBereitschaftsplanungBackend/src/main/resources/application.properties
+++ b/oKBereitschaftsplanungBackend/src/main/resources/application.properties
@@ -44,9 +44,7 @@
#SQL-init-scripts
sql.scripts.delete=delete/BER_delete_from
sql.scripts.init=init/BER_insert_standby_status,init/BER_insert_postcode,init/BER_insert_branch,init/BER_insert_user_function,init/BER_insert_location,init/BER_insert_int_location_has_postcode,init/BER_insert_region,init/BER_insert_int_regions_in_location,init/BER_insert_address,init/BER_insert_organisation,init/BER_insert_contact_data,init/BER_insert_standby_user,init/BER_insert_standby_group,init/BER_insert_user_in_region,init/BER_insert_int_standbygroup_has_function,init/BER_insert_standby_list,init/BER_insert_standby_list_has_standby_group,init/BER_insert_standby_schedule_body,init/BER_insert_standby_duration,init/BER_insert_int_branches_for_group,init/BER_insert_int_regions_for_standby_group,init/BER_insert_location_for_branch,init/BER_insert_user_in_standby_group
-#sql.scripts.hist=hist/BER_hist_address,hist/BER_hist_branch,hist/BER_hist_calendar,hist/BER_hist_contact_data,hist/BER_hist_int_branches_for_groups,hist/BER_hist_standby_list_has_standby_group,hist/BER_hist_int_location_has_postcode,hist/BER_hist_int_regions_in_location,hist/BER_hist_location,hist/BER_hist_location_for_branch,hist/BER_hist_organisation,hist/BER_hist_postcode,hist/BER_hist_region,hist/BER_hist_standby_duration,hist/BER_hist_standby_group,hist/BER_hist_standby_list,hist/BER_hist_standby_planning_status,hist/BER_hist_standby_schedule_body,hist/BER_hist_standby_schedule_header,hist/BER_hist_standby_schedule_header,hist/BER_hist_standby_schedule_history,hist/BER_hist_standby_status,hist/BER_hist_standby_user,hist/BER_hist_user_function,hist/BER_hist_user_has_user_function,hist/BER_hist_user_in_region,hist/BER_hist_user_in_standby_group,hist/BER_hist_int_standbygroup_has_function
-sql.scripts.hist=
-
+sql.scripts.hist=hist/BER_Trigger,hist/BER_hist_address,hist/BER_hist_branch,hist/BER_hist_calendar,hist/BER_hist_contact_data,hist/BER_hist_int_branches_for_groups,hist/BER_hist_int_branches_for_group,hist/BER_hist_int_groups_in_list,hist/BER_hist_int_location_has_postcode,hist/BER_hist_int_regions_in_location,hist/BER_hist_location,hist/BER_hist_location_for_branch,hist/BER_hist_organisation,hist/BER_hist_postcode,hist/BER_hist_region,hist/BER_hist_standby_duration,hist/BER_hist_standby_group,hist/BER_hist_standby_list,hist/BER_hist_standby_planning_status,hist/BER_hist_standby_schedule_body,hist/BER_hist_standby_schedule_header,hist/BER_hist_standby_schedule_history,hist/BER_hist_standby_status,hist/BER_hist_standby_user,hist/BER_hist_user_function,hist/BER_hist_user_has_user_function,hist/BER_hist_user_in_region,hist/BER_hist_user_in_standby_group,hist/BER_hist_int_standbygroup_has_function
#Mail
mail.template.path=mail
smtp.active=true