From: Moritz Bunkus Date: Thu, 4 Jan 2007 10:58:01 +0000 (+0000) Subject: Primär- und Fremdschlüssel für Tabellen tax und taxkeys. Problem bei Zuordnung von... X-Git-Tag: release-2.4.1~1^2~95 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=f9504bdd4a868b62b545e42dc3ca374c988dc647;p=kivitendo-erp.git Primär- und Fremdschlüssel für Tabellen tax und taxkeys. Problem bei Zuordnung von taxkeys zu tax behoben. --- 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);