comparison 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
comparison
equal deleted inserted replaced
4748:47922c1a088d 4749:fd9f171b87e4
626 country char(2) NOT NULL REFERENCES countries 626 country char(2) NOT NULL REFERENCES countries
627 DEFAULT users.user_country(), 627 DEFAULT users.user_country(),
628 date_info timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, 628 date_info timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
629 source_organization varchar NOT NULL, 629 source_organization varchar NOT NULL,
630 staging_done boolean NOT NULL DEFAULT false, 630 staging_done boolean NOT NULL DEFAULT false,
631 -- Disallow the same name for different countries
632 EXCLUDE USING GiST (name WITH =, country WITH <>),
633 -- Allow the same name one time in and outside staging area, each
631 UNIQUE(name, staging_done) 634 UNIQUE(name, staging_done)
632 ) 635 )
633 CREATE TRIGGER sections_date_info 636 CREATE TRIGGER sections_date_info
634 BEFORE UPDATE ON sections 637 BEFORE UPDATE ON sections
635 FOR EACH ROW EXECUTE PROCEDURE update_date_info() 638 FOR EACH ROW EXECUTE PROCEDURE update_date_info()