Mercurial > gemma
annotate schema/updates/1402/01.group_layers.sql @ 5099:3cd736acbad3 queued-stage-done
First version of a reviewed job. I bet it does not work.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 24 Mar 2020 15:46:37 +0100 |
parents | 45ef039cf4a8 |
children |
rev | line source |
---|---|
4930
8b83b18a1d49
Added database models for group layers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 CREATE TABLE sys_admin.layer_groups ( |
8b83b18a1d49
Added database models for group layers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 name varchar PRIMARY KEY |
8b83b18a1d49
Added database models for group layers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
3 ); |
8b83b18a1d49
Added database models for group layers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
4 |
8b83b18a1d49
Added database models for group layers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
5 CREATE TABLE sys_admin.grouped_layers ( |
8b83b18a1d49
Added database models for group layers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
6 group_name varchar REFERENCES sys_admin.layer_groups ON DELETE CASCADE, |
8b83b18a1d49
Added database models for group layers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
7 schema varchar, |
8b83b18a1d49
Added database models for group layers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
8 name varchar, |
8b83b18a1d49
Added database models for group layers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
9 ord int NOT NULL DEFAULT 0, |
8b83b18a1d49
Added database models for group layers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 PRIMARY KEY (group_name, schema, name), |
8b83b18a1d49
Added database models for group layers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
11 UNIQUE (group_name, schema, name, ord), |
8b83b18a1d49
Added database models for group layers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
12 FOREIGN KEY(schema, name) REFERENCES sys_admin.published_services |
8b83b18a1d49
Added database models for group layers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
13 ); |
8b83b18a1d49
Added database models for group layers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
14 |
4933
45ef039cf4a8
grant select rights to sys_admin to new group layers tables.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
4930
diff
changeset
|
15 GRANT SELECT ON sys_admin.layer_groups, sys_admin.grouped_layers TO sys_admin; |