From a34e8502594fc36388a6e28eb111d44c7846cdff Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 4 Feb 2015 16:27:57 +0100 Subject: [PATCH] =?utf8?q?Pflichtenhefte:=20bendef.=20Var.=20beim=20L?= =?utf8?q?=C3=B6schen=20des=20Pflichtenheftes=20via=20Trigger=20l=C3=B6sch?= =?utf8?q?en?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- ...es_delete_via_trigger_requirement_specs.sql | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 sql/Pg-upgrade2/custom_variables_delete_via_trigger_requirement_specs.sql diff --git a/sql/Pg-upgrade2/custom_variables_delete_via_trigger_requirement_specs.sql b/sql/Pg-upgrade2/custom_variables_delete_via_trigger_requirement_specs.sql new file mode 100644 index 000000000..da7de2a1e --- /dev/null +++ b/sql/Pg-upgrade2/custom_variables_delete_via_trigger_requirement_specs.sql @@ -0,0 +1,18 @@ +-- @tag: custom_variables_delete_via_trigger_requirement_specs +-- @description: Benutzerdefinierte Variablen von Pflichtenheften via Trigger löschen +-- @depends: custom_variables_delete_via_trigger requirement_specs +CREATE OR REPLACE FUNCTION delete_requirement_spec_custom_variables_trigger() RETURNS trigger AS $$ + BEGIN + DELETE FROM custom_variables WHERE (sub_module = '' OR sub_module IS NULL) + AND trans_id = OLD.id + AND (SELECT module FROM custom_variable_configs WHERE id = config_id) = 'RequirementSpecs'; + + RETURN OLD; + END; +$$ LANGUAGE plpgsql; + +DROP TRIGGER IF EXISTS delete_requirement_spec_custom_variables ON requirement_specs; + +CREATE TRIGGER delete_requirement_spec_custom_variables +BEFORE DELETE ON requirement_specs +FOR EACH ROW EXECUTE PROCEDURE delete_requirement_spec_custom_variables_trigger(); -- 2.20.1