From 5a96cf9eb384f654440c4426919653cb533f2798 Mon Sep 17 00:00:00 2001 From: Albert Bofill Date: Tue, 24 Dec 2024 17:12:16 +0100 Subject: [PATCH] fix(constraints): correct wrong constraint names --- updates/36/36017/ud/tablect.sql | 14 ++++++++++++++ updates/36/36017/ws/tablect.sql | 17 +++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 updates/36/36017/ws/tablect.sql diff --git a/updates/36/36017/ud/tablect.sql b/updates/36/36017/ud/tablect.sql index 477a56b27..ebb616725 100644 --- a/updates/36/36017/ud/tablect.sql +++ b/updates/36/36017/ud/tablect.sql @@ -12,5 +12,19 @@ SET search_path = SCHEMA_NAME, public, pg_catalog; CREATE INDEX gully_streetname ON arc USING btree (streetname); CREATE INDEX gully_streetname2 ON arc USING btree (streetname2); +ALTER TABLE connec DROP CONSTRAINT arc_drainzone_id_fkey; +ALTER TABLE connec ADD CONSTRAINT connec_drainzone_id_fkey FOREIGN KEY (drainzone_id) +REFERENCES drainzone(drainzone_id) ON UPDATE CASCADE ON DELETE RESTRICT; +ALTER TABLE connec DROP CONSTRAINT node_expl_id2_fkey; +ALTER TABLE connec ADD CONSTRAINT connec_expl_id2_fkey FOREIGN KEY (expl_id2) +REFERENCES exploitation(expl_id) ON UPDATE CASCADE ON DELETE RESTRICT; + +ALTER TABLE node DROP CONSTRAINT arc_drainzone_id_fkey; +ALTER TABLE node ADD CONSTRAINT node_drainzone_id_fkey FOREIGN KEY (drainzone_id) +REFERENCES drainzone(drainzone_id) ON UPDATE CASCADE ON DELETE RESTRICT; + +ALTER TABLE gully DROP CONSTRAINT arc_drainzone_id_fkey; +ALTER TABLE gully ADD CONSTRAINT gully_drainzone_id_fkey FOREIGN KEY (drainzone_id) +REFERENCES drainzone(drainzone_id) ON UPDATE CASCADE ON DELETE RESTRICT; diff --git a/updates/36/36017/ws/tablect.sql b/updates/36/36017/ws/tablect.sql new file mode 100644 index 000000000..1b97416a0 --- /dev/null +++ b/updates/36/36017/ws/tablect.sql @@ -0,0 +1,17 @@ +/* +This file is part of Giswater 3 +The program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. +This version of Giswater is provided by Giswater Association +*/ + + +SET search_path = SCHEMA_NAME, public, pg_catalog; + + +ALTER TABLE node DROP CONSTRAINT arc_macrominsector_id_fkey; +ALTER TABLE node ADD CONSTRAINT node_macrominsector_id_fkey FOREIGN KEY (macrominsector_id) +REFERENCES macrominsector(macrominsector_id) ON UPDATE CASCADE ON DELETE RESTRICT; + +ALTER TABLE connec DROP CONSTRAINT node_expl_id2_fkey; +ALTER TABLE connec ADD CONSTRAINT connec_expl_id2_fkey FOREIGN KEY (expl_id2) +REFERENCES exploitation(expl_id) ON UPDATE CASCADE ON DELETE RESTRICT; \ No newline at end of file