From: Moritz Bunkus Date: Wed, 4 Feb 2015 15:27:57 +0000 (+0100) Subject: Pflichtenhefte: bendef. Var. beim Löschen des Pflichtenheftes via Trigger löschen X-Git-Tag: release-3.2.1~51^2~14 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=a34e8502594fc36388a6e28eb111d44c7846cdff;p=kivitendo-erp.git Pflichtenhefte: bendef. Var. beim Löschen des Pflichtenheftes via Trigger löschen --- 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();