comparison schema/gemma.sql @ 2230:4374d942b23d

Remove debris and associate templates to country While the original idea was to associate templates to users, managed by a waterway admin per country, the new intention was to share templates between users per country. Just removing any constraints on readability and management of the templates did not fulfill this idea.
author Tom Gottfried <tom@intevation.de>
date Wed, 13 Feb 2019 10:52:14 +0100
parents 7e2c77ccc02f
children 37ae1bee3e4a
comparison
equal deleted inserted replaced
2229:6cce66a6ceb5 2230:4374d942b23d
181 CHECK(ST_IsValid(CAST(area AS geometry))) 181 CHECK(ST_IsValid(CAST(area AS geometry)))
182 ) 182 )
183 183
184 CREATE TABLE templates ( 184 CREATE TABLE templates (
185 template_name varchar PRIMARY KEY, 185 template_name varchar PRIMARY KEY,
186 country char(2) NOT NULL REFERENCES countries,
186 template_data bytea NOT NULL, 187 template_data bytea NOT NULL,
187 date_info timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP 188 date_info timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP
188 ) 189 )
189 CREATE TRIGGER templates_date_info BEFORE UPDATE ON templates 190 CREATE TRIGGER templates_date_info BEFORE UPDATE ON templates
190 FOR EACH ROW EXECUTE PROCEDURE update_date_info() 191 FOR EACH ROW EXECUTE PROCEDURE update_date_info()
191
192 -- CREATE TABLE user_templates (
193 -- username varchar NOT NULL
194 -- REFERENCES internal.user_profiles
195 -- ON DELETE CASCADE ON UPDATE CASCADE,
196 -- template_name varchar NOT NULL REFERENCES templates ON DELETE CASCADE,
197 -- PRIMARY KEY (username, template_name)
198 --)
199 ; 192 ;
200 ALTER TABLE internal.user_profiles ADD 193 ALTER TABLE internal.user_profiles ADD
201 country char(2) NOT NULL REFERENCES users.responsibility_areas; 194 country char(2) NOT NULL REFERENCES users.responsibility_areas;
202 195
203 196