]> SALOME platform Git repositories - modules/gde.git/blob - projects/GDE_App/src/GDE_DB_Init.sql
Salome HOME
Add study
[modules/gde.git] / projects / GDE_App / src / GDE_DB_Init.sql
1 drop sequence SEQ_GEN_SEQUENCE;
2 create sequence SEQ_GEN_SEQUENCE INCREMENT BY 50;
3
4 /* METADATA */
5
6 DROP TABLE attribute_group CASCADE;
7 CREATE TABLE attribute_group (
8     id bigint NOT NULL PRIMARY KEY
9 );
10
11 DROP TABLE attribute CASCADE;
12 CREATE TABLE attribute (
13     id bigint NOT NULL PRIMARY KEY,
14     name varchar(255),
15     type varchar(255),
16     value varchar(255),
17     attribute_group_id bigint REFERENCES attribute_group (id),
18     mandatory boolean
19 );
20
21 /* DATA */
22
23 DROP TABLE gde_file CASCADE;
24 CREATE TABLE gde_file (
25     id bigint NOT NULL PRIMARY KEY,
26     name varchar(255),
27     length bigint,
28     checksum varchar(255),
29     creation_date timestamp,
30     update_date timestamp,
31     valid boolean,
32     deleted boolean,
33     deletion_date timestamp,
34     attribute_group_id bigint REFERENCES attribute_group (id)
35 );
36
37 DROP TABLE chunk CASCADE;
38 CREATE TABLE chunk (
39     id bigint NOT NULL PRIMARY KEY,
40     file_id bigint NOT NULL REFERENCES gde_file (id),
41     rank bigint,
42     checksum varchar(255),
43     size bigint,
44     data bytea
45 );
46
47 /* STUDIES */
48
49 DROP TABLE study CASCADE;
50 CREATE TABLE study (
51     id bigint NOT NULL PRIMARY KEY,
52     name varchar(255),
53     creation_date timestamp,
54     update_date timestamp,
55     valid boolean,
56     deleted boolean,
57     deletion_date timestamp,
58     attribute_group_id bigint REFERENCES attribute_group (id)
59 );
60
61 /* PROFILES */
62
63 DROP TABLE profile CASCADE;
64 CREATE TABLE profile (
65     id bigint NOT NULL PRIMARY KEY,
66     name varchar(255)
67 );
68
69 DROP TABLE profile_attribute CASCADE;
70 CREATE TABLE profile_attribute (
71     id bigint NOT NULL PRIMARY KEY,
72     name varchar(255),
73     type varchar(255),
74     mandatory boolean,
75     profile_id bigint REFERENCES profile (id)
76 );