Mercurial > gemma
comparison 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 |
comparison
equal
deleted
inserted
replaced
2366:ff1e4f1b54c6 | 2367:0aedae39726e |
---|---|
176 area geography(MULTIPOLYGON, 4326) | 176 area geography(MULTIPOLYGON, 4326) |
177 CHECK(ST_IsValid(CAST(area AS geometry))) | 177 CHECK(ST_IsValid(CAST(area AS geometry))) |
178 ) | 178 ) |
179 | 179 |
180 CREATE TABLE templates ( | 180 CREATE TABLE templates ( |
181 template_name varchar PRIMARY KEY, | 181 template_name varchar NOT NULL, |
182 country char(2) REFERENCES countries, | 182 country char(2) REFERENCES countries, |
183 template_data bytea NOT NULL, | 183 template_data bytea NOT NULL, |
184 date_info timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP | 184 date_info timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, |
185 UNIQUE (template_name, country) | |
185 ) | 186 ) |
186 CREATE TRIGGER templates_date_info BEFORE UPDATE ON templates | 187 CREATE TRIGGER templates_date_info BEFORE UPDATE ON templates |
187 FOR EACH ROW EXECUTE PROCEDURE update_date_info() | 188 FOR EACH ROW EXECUTE PROCEDURE update_date_info() |
188 ; | 189 ; |
189 ALTER TABLE internal.user_profiles ADD | 190 ALTER TABLE internal.user_profiles ADD |