1 |
d2a8c3fd
|
Marc NICOLAS
|
DROP TABLE IF EXISTS "sitools"."USER_GROUP";
|
2 |
|
|
DROP TABLE IF EXISTS "sitools"."USERS";
|
3 |
|
|
DROP TABLE IF EXISTS "sitools"."GROUPS";
|
4 |
|
|
DROP TABLE IF EXISTS "sitools"."USER_PROPERTIES";
|
5 |
|
|
|
6 |
|
|
DROP SCHEMA IF EXISTS "sitools";
|
7 |
|
|
CREATE SCHEMA "sitools";
|
8 |
|
|
|
9 |
|
|
CREATE TABLE IF NOT EXISTS "sitools"."USERS" (
|
10 |
|
|
identifier varchar(64) NOT NULL,
|
11 |
|
|
firstname varchar(32) DEFAULT NULL,
|
12 |
|
|
lastname varchar(32) DEFAULT NULL,
|
13 |
|
|
email varchar(128) DEFAULT NULL,
|
14 |
|
|
secret varchar(40) DEFAULT NULL,
|
15 |
|
|
PRIMARY KEY (identifier)
|
16 |
|
|
);
|
17 |
|
|
|
18 |
|
|
INSERT INTO "sitools"."USERS" (identifier, firstname, lastname, email, secret) VALUES
|
19 |
|
|
('admin', 'firstname', 'lastname', 'admin-sitools@cnes.fr', 'admin');
|
20 |
|
|
|
21 |
|
|
CREATE TABLE IF NOT EXISTS "sitools"."GROUPS" (
|
22 |
|
|
name varchar(32) NOT NULL,
|
23 |
|
|
description varchar(128) DEFAULT NULL,
|
24 |
|
|
PRIMARY KEY (name)
|
25 |
|
|
);
|
26 |
|
|
|
27 |
|
|
|
28 |
|
|
|
29 |
|
|
|
30 |
|
|
|
31 |
|
|
INSERT INTO "sitools"."GROUPS" (name, description) VALUES
|
32 |
|
|
('register', 'Group of registered persons'),
|
33 |
|
|
('administrator', 'Group of persons managing the archive system');
|
34 |
|
|
|
35 |
|
|
|
36 |
|
|
CREATE TABLE IF NOT EXISTS "sitools"."USER_GROUP" (
|
37 |
|
|
identifier varchar(64) NOT NULL,
|
38 |
|
|
name varchar(32) NOT NULL,
|
39 |
|
|
PRIMARY KEY (identifier,name),
|
40 |
|
|
FOREIGN KEY (name) REFERENCES "sitools"."GROUPS" (name),
|
41 |
|
|
FOREIGN KEY (identifier) REFERENCES "sitools"."USERS" (identifier)
|
42 |
|
|
);
|
43 |
|
|
|
44 |
|
|
|
45 |
|
|
|
46 |
|
|
|
47 |
|
|
|
48 |
|
|
INSERT INTO "sitools"."USER_GROUP" (identifier, name) VALUES
|
49 |
|
|
('admin', 'administrator');
|
50 |
|
|
|
51 |
|
|
CREATE TABLE IF NOT EXISTS "sitools"."USER_PROPERTIES" (
|
52 |
|
|
key varchar(64) NOT NULL,
|
53 |
|
|
value varchar(256) DEFAULT NULL,
|
54 |
|
|
identifier varchar(64) DEFAULT NULL,
|
55 |
|
|
scope varchar(8) DEFAULT NULL,
|
56 |
|
|
PRIMARY KEY (key)
|
57 |
|
|
);
|
58 |
|
|
|
59 |
|
|
ALTER USER "sitools" SET PASSWORD "sitools"; |