drop sequence SEQ_GEN_SEQUENCE;
create sequence SEQ_GEN_SEQUENCE INCREMENT BY 50;
+/* METADATA */
+
DROP TABLE attribute_group CASCADE;
CREATE TABLE attribute_group (
- id int8 PRIMARY KEY
+ id bigint NOT NULL PRIMARY KEY
);
DROP TABLE attribute CASCADE;
CREATE TABLE attribute (
- id int8 PRIMARY KEY,
+ id bigint NOT NULL PRIMARY KEY,
name varchar(255),
type varchar(255),
value varchar(255),
- group_id int8 REFERENCES attribute_group (id),
+ attribute_group_id bigint REFERENCES attribute_group (id),
mandatory boolean
);
-DROP TABLE file CASCADE;
-CREATE TABLE file (
- id int8 PRIMARY KEY,
+/* DATA */
+
+DROP TABLE gde_file CASCADE;
+CREATE TABLE gde_file (
+ id bigint NOT NULL PRIMARY KEY,
name varchar(255),
- length int8,
+ length bigint,
checksum varchar(255),
creation_date timestamp,
update_date timestamp,
valid boolean,
deleted boolean,
deletion_date timestamp,
- group_id int8 REFERENCES attribute_group (id)
+ attribute_group_id bigint REFERENCES attribute_group (id)
);
DROP TABLE chunk CASCADE;
CREATE TABLE chunk (
- id int8 PRIMARY KEY,
- file_id int8 REFERENCES file (id),
- rank int8,
+ id bigint NOT NULL PRIMARY KEY,
+ file_id bigint NOT NULL REFERENCES gde_file (id),
+ rank bigint,
checksum varchar(255),
- size int8,
+ size bigint,
data bytea
);
-/*
-DROP TABLE data CASCADE;
-CREATE TABLE data (
- file_id int8 REFERENCES file (id),
- metadata_id int8 REFERENCES attribute_group (id),
- PRIMARY KEY (file_id, metadata_id)
+
+/* STUDIES */
+
+DROP TABLE study CASCADE;
+CREATE TABLE study (
+ id bigint NOT NULL PRIMARY KEY,
+ name varchar(255),
+ creation_date timestamp,
+ update_date timestamp,
+ valid boolean,
+ deleted boolean,
+ deletion_date timestamp,
+ attribute_group_id bigint REFERENCES attribute_group (id)
);
-*/
+
+/* PROFILES */
+
DROP TABLE profile CASCADE;
CREATE TABLE profile (
- id int8 PRIMARY KEY,
+ id bigint NOT NULL PRIMARY KEY,
name varchar(255)
);
DROP TABLE profile_attribute CASCADE;
CREATE TABLE profile_attribute (
- id int8 PRIMARY KEY,
+ id bigint NOT NULL PRIMARY KEY,
name varchar(255),
type varchar(255),
mandatory boolean,
- profile_id int8 REFERENCES profile (id)
+ profile_id bigint REFERENCES profile (id)
);