Wenn Datenbanken mit älteren PostgreSQL-Versionen angelegt wurden,
dann kann es sein, dass die FKEY-Constraint anders benannt war.
-- @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 $$
--- /dev/null
+# @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;