Mercurial > gemma
diff schema/gemma.sql @ 2367:0aedae39726e
Print templates: Removed primary key from templates table and add a unique constraint to template name and country instead to make possible that different countries can use templates with same name.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 21 Feb 2019 10:46:38 +0100 |
parents | fb353ff08377 |
children | 89a3096e1988 |
line wrap: on
line diff
--- a/schema/gemma.sql Thu Feb 21 09:58:24 2019 +0100 +++ b/schema/gemma.sql Thu Feb 21 10:46:38 2019 +0100 @@ -178,10 +178,11 @@ ) CREATE TABLE templates ( - template_name varchar PRIMARY KEY, + template_name varchar NOT NULL, country char(2) REFERENCES countries, template_data bytea NOT NULL, - date_info timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP + date_info timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, + UNIQUE (template_name, country) ) CREATE TRIGGER templates_date_info BEFORE UPDATE ON templates FOR EACH ROW EXECUTE PROCEDURE update_date_info()