Mercurial > gemma
comparison schema/gemma.sql @ 3189:6f8fb2053881
Schema: Added type column for users.templates. TODO: Add backend code to filter by it.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 08 May 2019 10:37:47 +0200 |
parents | 1cb6676d1510 |
children | 4c254651d80b |
comparison
equal
deleted
inserted
replaced
3188:c36940e53788 | 3189:6f8fb2053881 |
---|---|
198 | 198 |
199 CREATE TABLE measure_types ( | 199 CREATE TABLE measure_types ( |
200 measure_type varchar PRIMARY KEY | 200 measure_type varchar PRIMARY KEY |
201 ); | 201 ); |
202 | 202 |
203 CREATE TYPE template_types AS ENUM ( | |
204 'map', | |
205 'diagram', | |
206 'report' | |
207 ); | |
203 | 208 |
204 -- Namespace for user management related data | 209 -- Namespace for user management related data |
205 CREATE SCHEMA users | 210 CREATE SCHEMA users |
206 CREATE TABLE responsibility_areas ( | 211 CREATE TABLE responsibility_areas ( |
207 country char(2) PRIMARY KEY REFERENCES countries, | 212 country char(2) PRIMARY KEY REFERENCES countries, |
209 CHECK(ST_IsValid(CAST(area AS geometry))) | 214 CHECK(ST_IsValid(CAST(area AS geometry))) |
210 ) | 215 ) |
211 | 216 |
212 CREATE TABLE templates ( | 217 CREATE TABLE templates ( |
213 template_name varchar NOT NULL, | 218 template_name varchar NOT NULL, |
219 template_type template_types NOT NULL DEFAULT 'map'::template_types, | |
214 country char(2) REFERENCES countries, | 220 country char(2) REFERENCES countries, |
215 template_data bytea NOT NULL, | 221 template_data bytea NOT NULL, |
216 date_info timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, | 222 date_info timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, |
217 UNIQUE (template_name, country) | 223 UNIQUE (template_name, country) |
218 ) | 224 ) |