From f9504bdd4a868b62b545e42dc3ca374c988dc647 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 4 Jan 2007 10:58:01 +0000 Subject: [PATCH] =?utf8?q?Prim=C3=A4r-=20und=20Fremdschl=C3=BCssel=20f?= =?utf8?q?=C3=BCr=20Tabellen=20tax=20und=20taxkeys.=20Problem=20bei=20Zuor?= =?utf8?q?dnung=20von=20taxkeys=20zu=20tax=20behoben.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- sql/Pg-upgrade2/tax_id_if_taxkey_is_0.sql | 1 + sql/Pg-upgrade2/tax_primary_key_taxkeys_foreign_keys.sql | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 sql/Pg-upgrade2/tax_primary_key_taxkeys_foreign_keys.sql diff --git a/sql/Pg-upgrade2/tax_id_if_taxkey_is_0.sql b/sql/Pg-upgrade2/tax_id_if_taxkey_is_0.sql index 3df341430..a3eaf4d75 100644 --- a/sql/Pg-upgrade2/tax_id_if_taxkey_is_0.sql +++ b/sql/Pg-upgrade2/tax_id_if_taxkey_is_0.sql @@ -2,3 +2,4 @@ -- @description: Aktualisierung der Spalte tax.id, wenn tax.taxkey = 0 ist. -- @depends: UPDATE tax SET id = 0 WHERE taxkey = 0; +UPDATE taxkeys SET tax_id = 0 WHERE taxkey_id = 0; diff --git a/sql/Pg-upgrade2/tax_primary_key_taxkeys_foreign_keys.sql b/sql/Pg-upgrade2/tax_primary_key_taxkeys_foreign_keys.sql new file mode 100644 index 000000000..cc4b7cf0a --- /dev/null +++ b/sql/Pg-upgrade2/tax_primary_key_taxkeys_foreign_keys.sql @@ -0,0 +1,5 @@ +-- @tag: tax_primary_key_taxkeys_foreign_keys +-- @description: Legt in tax einen neuen Primärschlüssel und in taxkeys einen neuen Fremdschlüssel auf tax an. +-- @depends: tax_id_if_taxkey_is_0 +ALTER TABLE tax ADD PRIMARY KEY (id); +ALTER TABLE taxkeys ADD FOREIGN KEY (tax_id) REFERENCES tax (id); -- 2.20.1