From ad9b15c2da87c6ee98f0990b49c8dff0f09cf581 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 7 Jan 2014 09:43:35 +0100 Subject: [PATCH] =?utf8?q?Fix=20DB-Upgrade=20=C2=BBWiedervorlagen=20l?= =?utf8?q?=C3=B6schen,=20wenn=20dazugeh=C3=B6rige=20Belege=20gel=C3=B6scht?= =?utf8?q?=20werden=C2=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Wenn Datenbanken mit älteren PostgreSQL-Versionen angelegt wurden, dann kann es sein, dass die FKEY-Constraint anders benannt war. --- ...ollow_ups_when_order_is_deleted_closed.sql | 5 ++--- ...n_order_is_deleted_closed_fkey_deletion.pl | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 sql/Pg-upgrade2/delete_close_follow_ups_when_order_is_deleted_closed_fkey_deletion.pl 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; -- 2.20.1