From 086e9880b6aeb6c3e95bcf4a4a84b985909346df Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 8 Jun 2016 16:05:09 +0200 Subject: [PATCH] generic_translations: DB-Upgrade in Perl geschrieben wg. Constraint-Namen MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit In alten PostgreSQL-Versionen hießen Foreign-Key-Constraints oft noch so was wie »$1«. Da sich das Upgrade-Script also bzgl. des Namens nicht sicher sein kann, gibt's momentan nur die Möglichkeit, einmal alle Foreign-Keys zu einer Tabelle wegzuwerfen und diese neu anzulegen. Dafür wiederum haben wir Support-Funktionen in SL::DBUpgrade2::Base, die wie nutzen können. Also Umstellung des Scripts auf Perl. --- ...neric_translations_on_language_deletion.pl | 35 +++++++++++++++++++ ...eric_translations_on_language_deletion.sql | 15 -------- 2 files changed, 35 insertions(+), 15 deletions(-) create mode 100644 sql/Pg-upgrade2/delete_from_generic_translations_on_language_deletion.pl delete mode 100644 sql/Pg-upgrade2/delete_from_generic_translations_on_language_deletion.sql diff --git a/sql/Pg-upgrade2/delete_from_generic_translations_on_language_deletion.pl b/sql/Pg-upgrade2/delete_from_generic_translations_on_language_deletion.pl new file mode 100644 index 000000000..24ee4ebad --- /dev/null +++ b/sql/Pg-upgrade2/delete_from_generic_translations_on_language_deletion.pl @@ -0,0 +1,35 @@ +# @tag: delete_from_generic_translations_on_language_deletion +# @description: Übersetzungen automatisch löschen, wenn die dazugehörige Sprache gelöscht wird +# @depends: release_3_4_0 +package SL::DBUpgrade2::delete_from_generic_translations_on_language_deletion; + +use strict; +use utf8; + +use parent qw(SL::DBUpgrade2::Base); + +sub run { + my ($self) = @_; + + $self->drop_constraints(table => 'generic_translations'); + + $self->db_query(<db_query(<