From: Moritz Bunkus Date: Tue, 7 Jan 2014 08:43:35 +0000 (+0100) Subject: Fix DB-Upgrade »Wiedervorlagen löschen, wenn dazugehörige Belege gelöscht werden« X-Git-Tag: release-3.1.0beta1~22^2~33^2~4 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=ad9b15c2da87c6ee98f0990b49c8dff0f09cf581;p=kivitendo-erp.git Fix DB-Upgrade »Wiedervorlagen löschen, wenn dazugehörige Belege gelöscht werden« Wenn Datenbanken mit älteren PostgreSQL-Versionen angelegt wurden, dann kann es sein, dass die FKEY-Constraint anders benannt war. --- diff --git a/sql/Pg-upgrade2/delete_close_follow_ups_when_order_is_deleted_closed.sql b/sql/Pg-upgrade2/delete_close_follow_ups_when_order_is_deleted_closed.sql index e13a7bd76..f2963f5f3 100644 --- a/sql/Pg-upgrade2/delete_close_follow_ups_when_order_is_deleted_closed.sql +++ b/sql/Pg-upgrade2/delete_close_follow_ups_when_order_is_deleted_closed.sql @@ -1,9 +1,8 @@ -- @tag: delete_close_follow_ups_when_order_is_deleted_closed -- @description: Wiedervorlagen löschen/schließen, wenn dazugehörige Belege gelöscht/geschlossen werden --- @depends: release_3_0_0 +-- @depends: delete_close_follow_ups_when_order_is_deleted_closed_fkey_deletion -ALTER TABLE follow_up_links DROP CONSTRAINT follow_up_links_follow_up_id_fkey; -ALTER TABLE follow_up_links ADD FOREIGN KEY (follow_up_id) REFERENCES follow_ups (id) ON DELETE CASCADE; +ALTER TABLE follow_up_links ADD CONSTRAINT follow_up_links_follow_up_id_fkey FOREIGN KEY (follow_up_id) REFERENCES follow_ups (id) ON DELETE CASCADE; CREATE OR REPLACE FUNCTION follow_up_delete_notes_trigger() RETURNS TRIGGER AS $$ diff --git a/sql/Pg-upgrade2/delete_close_follow_ups_when_order_is_deleted_closed_fkey_deletion.pl b/sql/Pg-upgrade2/delete_close_follow_ups_when_order_is_deleted_closed_fkey_deletion.pl new file mode 100644 index 000000000..1e41817ee --- /dev/null +++ b/sql/Pg-upgrade2/delete_close_follow_ups_when_order_is_deleted_closed_fkey_deletion.pl @@ -0,0 +1,19 @@ +# @tag: delete_close_follow_ups_when_order_is_deleted_closed_fkey_deletion +# @description: delete_close_follow_ups_when_order_is_deleted_closed_fkey_deletion +# @depends: release_3_0_0 +package SL::DBUpgrade2::delete_close_follow_ups_when_order_is_deleted_closed_fkey_deletion; + +use strict; +use utf8; + +use parent qw(SL::DBUpgrade2::Base); + +sub run { + my ($self) = @_; + + $self->drop_constraints(table => "follow_up_links"); + + return 1; +} + +1;