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