diff schema/gemma.sql @ 4749:fd9f171b87e4

Generally disallow the same section name for different countries This avoids the situation that a waterway admin is informed about the duplicate name only on trying to accept the import of a new section. Such an import will now end up failed.
author Tom Gottfried <tom@intevation.de>
date Fri, 18 Oct 2019 15:45:48 +0200
parents 47922c1a088d
children dfd990a4ac64
line wrap: on
line diff
--- a/schema/gemma.sql	Fri Oct 18 15:34:34 2019 +0200
+++ b/schema/gemma.sql	Fri Oct 18 15:45:48 2019 +0200
@@ -628,6 +628,9 @@
         date_info timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
         source_organization varchar NOT NULL,
         staging_done boolean NOT NULL DEFAULT false,
+        -- Disallow the same name for different countries
+        EXCLUDE USING GiST (name WITH =, country WITH <>),
+        -- Allow the same name one time in and outside staging area, each
         UNIQUE(name, staging_done)
     )
     CREATE TRIGGER sections_date_info