From 86299a413d457abfa10f657b243d00b194702824 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 8 Jun 2016 09:20:35 +0200 Subject: [PATCH] =?utf8?q?generic=5Ftranslations:=20Eintr=C3=A4ge=20automa?= =?utf8?q?tisch=20l=C3=B6schen,=20wenn=20Sprache=20gel=C3=B6scht=20wird?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- ..._generic_translations_on_language_deletion.sql | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create 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.sql b/sql/Pg-upgrade2/delete_from_generic_translations_on_language_deletion.sql new file mode 100644 index 000000000..e01b51c66 --- /dev/null +++ b/sql/Pg-upgrade2/delete_from_generic_translations_on_language_deletion.sql @@ -0,0 +1,15 @@ +-- @tag: delete_from_generic_translations_on_language_deletion +-- @description: Übersetzungen automatisch löschen, wenn die dazugehörige Sprache gelöscht wird +-- @depends: release_3_3_0 +ALTER TABLE generic_translations + DROP CONSTRAINT generic_translations_language_id_fkey, + ADD CONSTRAINT generic_translations_language_id_fkey + FOREIGN KEY (language_id) + REFERENCES language (id) + ON DELETE CASCADE; + +DELETE FROM generic_translations +WHERE language_id NOT IN ( + SELECT id + FROM language +); -- 2.20.1