diff 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
line wrap: on
line diff
--- a/schema/gemma.sql	Wed Feb 13 08:00:26 2019 +0100
+++ b/schema/gemma.sql	Wed Feb 13 10:52:14 2019 +0100
@@ -183,19 +183,12 @@
 
     CREATE TABLE templates (
         template_name varchar PRIMARY KEY,
+        country char(2) NOT NULL REFERENCES countries,
         template_data bytea NOT NULL,
         date_info timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP
     )
     CREATE TRIGGER templates_date_info BEFORE UPDATE ON templates
         FOR EACH ROW EXECUTE PROCEDURE update_date_info()
-
-    -- CREATE TABLE user_templates (
-    --    username varchar NOT NULL
-    --        REFERENCES internal.user_profiles
-    --            ON DELETE CASCADE ON UPDATE CASCADE,
-    --    template_name varchar NOT NULL REFERENCES templates ON DELETE CASCADE,
-    --    PRIMARY KEY (username, template_name)
-    --)
 ;
 ALTER TABLE internal.user_profiles ADD
     country char(2) NOT NULL REFERENCES users.responsibility_areas;