Skip to content
Snippets Groups Projects
Commit 4807d5eb authored by buczekp's avatar buczekp
Browse files

[LMS-1495] new db version

SVN: 15873
parent 09d9b94a
No related branches found
No related tags found
No related merge requests found
Showing
with 1268 additions and 1 deletion
......@@ -24,7 +24,7 @@ package ch.systemsx.cisd.openbis.generic.server.dataaccess.db;
public final class DatabaseVersionHolder
{
/** Current version of the database. */
private static final String DATABASE_VERSION = "051";
private static final String DATABASE_VERSION = "052";
private DatabaseVersionHolder()
{
......
----------------------------------------------------------------------------
-- Purpose: Insert an initial data set into the table DATABASE_INSTANCES
----------------------------------------------------------------------------
INSERT INTO database_instances(
id
, code
, uuid
, is_original_source)
VALUES ( nextval('DATABASE_INSTANCE_ID_SEQ')
, 'SYSTEM_DEFAULT'
, 'SYSTEM_DEFAULT'
, 'T');
----------------------------------------------------------------------
-- Purpose: Insert an initial data set into the table DATA_STORES
----------------------------------------------------------------------
insert into data_stores
(id
,code
,download_url
,remote_url
,session_token
,dbin_id)
values
(nextval('DATA_STORE_ID_SEQ')
,'STANDARD'
,''
,''
,''
,(select id from database_instances where code = 'SYSTEM_DEFAULT')
);
----------------------------------------------------------------------
-- Purpose: Insert an initial data set into the table PERSONS
-----------------------------------------------------------------------
insert into persons
(id
,first_name
,last_name
,user_id
,email
,dbin_id)
values
(nextval('PERSON_ID_SEQ')
,''
,'System User'
,'system'
,''
,(select id from database_instances where code = 'SYSTEM_DEFAULT') );
-----------------------------------------------------------------------------------
-- Purpose: Create Controlled Vocabulary STORAGE_FORMAT
-----------------------------------------------------------------------------------
insert into controlled_vocabularies
( id
, code
, is_internal_namespace
, description
, pers_id_registerer
, is_managed_internally
, dbin_id)
values (nextval('CONTROLLED_VOCABULARY_ID_SEQ')
, 'STORAGE_FORMAT'
, true
, 'The on-disk storage format of a data set'
, (select id from persons where user_id ='system')
, true
, (select id from database_instances where code = 'SYSTEM_DEFAULT'));
-----------------------------------------------------------------------------------
-- Purpose: Create Controlled Vocabulary Terms for STORAGE_FORMAT
-----------------------------------------------------------------------------------
insert into controlled_vocabulary_terms
( id
, code
, covo_id
, pers_id_registerer
, ordinal )
values (nextval('CVTE_ID_SEQ')
, 'PROPRIETARY'
, (select id from controlled_vocabularies where code = 'STORAGE_FORMAT' and is_internal_namespace = true)
, (select id from persons where user_id ='system')
, 1);
insert into controlled_vocabulary_terms
( id
, code
, covo_id
, pers_id_registerer
, ordinal)
values (nextval('CVTE_ID_SEQ')
, 'BDS_DIRECTORY'
, (select id from controlled_vocabularies where code = 'STORAGE_FORMAT' and is_internal_namespace = true)
, (select id from persons where user_id ='system')
, 2);
------------------------------------------------------------------
-- Purpose: Insert an initial data set into the table DATA_TYPES
------------------------------------------------------------------
insert into data_types
(id
,code
,description)
values
(nextval('DATA_TYPE_ID_SEQ')
,'VARCHAR'
,'Short text'
);
insert into data_types
(id
,code
,description)
values
(nextval('DATA_TYPE_ID_SEQ')
,'MULTILINE_VARCHAR'
,'Long text'
);
insert into data_types
(id
,code
,description)
values
(nextval('DATA_TYPE_ID_SEQ')
,'INTEGER'
,'Integer number'
);
insert into data_types
(id
,code
,description)
values
(nextval('DATA_TYPE_ID_SEQ')
,'REAL'
,'Real number, i.e. an inexact, variable-precision numeric type'
);
insert into data_types
(id
,code
,description)
values
(nextval('DATA_TYPE_ID_SEQ')
,'BOOLEAN'
,'True or False'
);
insert into data_types
(id
,code
,description)
values
(nextval('DATA_TYPE_ID_SEQ')
,'TIMESTAMP'
,'Both date and time. Format: yyyy-mm-dd hh:mm:ss'
);
insert into data_types
(id
,code
,description)
values
(nextval('DATA_TYPE_ID_SEQ')
,'CONTROLLEDVOCABULARY'
,'Controlled Vocabulary'
);
insert into data_types
(id
,code
,description)
values
(nextval('DATA_TYPE_ID_SEQ')
,'MATERIAL'
,'Reference to a material'
);
insert into data_types
(id
,code
,description)
values
(nextval('DATA_TYPE_ID_SEQ')
,'HYPERLINK'
,'Address of a web page'
);
----------------------------------------------------------------------
-- Purpose: Insert an initial data set into the table PROPERTY_TYPES
-----------------------------------------------------------------------
insert into property_types
(id
,code
,description
,label
,daty_id
,pers_id_registerer
,dbin_id)
values
(nextval('PROPERTY_TYPE_ID_SEQ')
,'DESCRIPTION'
,'A Description'
,'Description'
,(select id from data_types where code ='VARCHAR')
,(select id from persons where user_id ='system')
,(select id from database_instances where code = 'SYSTEM_DEFAULT')
);
--------------------------------------------------------------------------
-- Purpose: Insert an initial data set into the table DATA_SET_TYPES
--------------------------------------------------------------------------
insert into data_set_types
(id
,code
,description
,dbin_id)
values
(nextval('DATA_SET_TYPE_ID_SEQ')
,'UNKNOWN'
,'Unknown'
,(select id from database_instances where code = 'SYSTEM_DEFAULT')
);
-------------------------------------------------------------------------
-- Purpose: Insert an initial data set into the table FILE_FORMAT_TYPES
-------------------------------------------------------------------------
insert into file_format_types
(id
,code
,description
,dbin_id)
values
(nextval('FILE_FORMAT_TYPE_ID_SEQ')
,'HDF5'
,'Hierarchical Data Format File, version 5'
,(select id from database_instances where code = 'SYSTEM_DEFAULT')
);
insert into file_format_types
(id
,code
,description
,dbin_id)
values
(nextval('FILE_FORMAT_TYPE_ID_SEQ')
,'PROPRIETARY'
,'Proprietary Format File'
,(select id from database_instances where code = 'SYSTEM_DEFAULT')
);
insert into file_format_types
(id
,code
,description
,dbin_id)
values
(nextval('FILE_FORMAT_TYPE_ID_SEQ')
,'SRF'
,'Sequence Read Format File'
,(select id from database_instances where code = 'SYSTEM_DEFAULT')
);
insert into file_format_types
(id
,code
,description
,dbin_id)
values
(nextval('FILE_FORMAT_TYPE_ID_SEQ')
,'TIFF'
,'TIFF File'
,(select id from database_instances where code = 'SYSTEM_DEFAULT')
);
insert into file_format_types
(id
,code
,description
,dbin_id)
values
(nextval('FILE_FORMAT_TYPE_ID_SEQ')
,'TSV'
,'Tab Separated Values File'
,(select id from database_instances where code = 'SYSTEM_DEFAULT')
);
insert into file_format_types
(id
,code
,description
,dbin_id)
values
(nextval('FILE_FORMAT_TYPE_ID_SEQ')
,'XML'
,'XML File'
,(select id from database_instances where code = 'SYSTEM_DEFAULT')
);
---------------------------------------------------------------------
-- Purpose: Insert an initial data set into the table LOCATOR_TYPES
---------------------------------------------------------------------
insert into locator_types
(id
,code
,description)
values
(nextval('LOCATOR_TYPE_ID_SEQ')
,'RELATIVE_LOCATION'
,'Relative Location'
);
This diff is collapsed.
-- Creating domains
CREATE DOMAIN AUTHORIZATION_ROLE AS VARCHAR(40) CHECK (VALUE IN ('ADMIN', 'POWER_USER', 'USER', 'OBSERVER', 'ETL_SERVER'));
CREATE DOMAIN BOOLEAN_CHAR AS BOOLEAN DEFAULT FALSE;
CREATE DOMAIN BOOLEAN_CHAR_OR_UNKNOWN AS CHAR(1) DEFAULT 'U' CHECK (VALUE IN ('F', 'T', 'U'));
CREATE DOMAIN CODE AS VARCHAR(60);
CREATE DOMAIN COLUMN_LABEL AS VARCHAR(128);
CREATE DOMAIN DATA_STORE_SERVICE_KIND AS VARCHAR(40) CHECK (VALUE IN ('PROCESSING', 'QUERIES'));
CREATE DOMAIN EVENT_TYPE AS VARCHAR(40) CHECK (VALUE IN ('DELETION', 'INVALIDATION', 'MOVEMENT'));
CREATE DOMAIN FILE AS BYTEA;
CREATE DOMAIN FILE_NAME AS VARCHAR(100);
CREATE DOMAIN GENERIC_VALUE AS VARCHAR(1024);
CREATE DOMAIN OBJECT_NAME AS VARCHAR(50);
CREATE DOMAIN REAL_VALUE AS REAL;
CREATE DOMAIN TECH_ID AS BIGINT;
CREATE DOMAIN TIME_STAMP AS TIMESTAMP WITH TIME ZONE;
CREATE DOMAIN TIME_STAMP_DFL AS TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP;
CREATE DOMAIN USER_ID AS VARCHAR(50);
CREATE DOMAIN TITLE_100 AS VARCHAR(100);
CREATE DOMAIN GRID_EXPRESSION AS VARCHAR(2000);
CREATE DOMAIN GRID_ID AS VARCHAR(200);
CREATE DOMAIN ORDINAL_INT AS BIGINT CHECK (VALUE > 0);
CREATE DOMAIN DESCRIPTION_2000 AS VARCHAR(2000);
CREATE DOMAIN ARCHIVING_STATUS AS VARCHAR(100) CHECK (VALUE IN ('LOCKED', 'AVAILABLE', 'ARCHIVED', 'ARCHIVE_PENDING', 'UNARCHIVE_PENDING'));
\ No newline at end of file
-- Creating Functions
------------------------------------------------------------------------------------
-- Purpose: Create function RENAME_SEQUENCE() that is required for renaming the sequences belonging to tables
------------------------------------------------------------------------------------
CREATE FUNCTION RENAME_SEQUENCE(OLD_NAME VARCHAR, NEW_NAME VARCHAR) RETURNS INTEGER AS $$
DECLARE
CURR_SEQ_VAL INTEGER;
BEGIN
SELECT INTO CURR_SEQ_VAL NEXTVAL(OLD_NAME);
EXECUTE 'CREATE SEQUENCE ' || NEW_NAME || ' START WITH ' || CURR_SEQ_VAL;
EXECUTE 'DROP SEQUENCE ' || OLD_NAME;
RETURN CURR_SEQ_VAL;
END;
$$ LANGUAGE 'plpgsql';
------------------------------------------------------------------------------------
-- Purpose: Create trigger CONTROLLED_VOCABULARY_CHECK
------------------------------------------------------------------------------------
CREATE OR REPLACE FUNCTION CONTROLLED_VOCABULARY_CHECK() RETURNS trigger AS $$
DECLARE
v_code CODE;
BEGIN
select code into v_code from data_types where id = NEW.daty_id;
-- Check if the data is of type "CONTROLLEDVOCABULARY"
if v_code = 'CONTROLLEDVOCABULARY' then
if NEW.covo_id IS NULL then
RAISE EXCEPTION 'Insert/Update of Property Type (Code: %) failed, as its Data Type is CONTROLLEDVOCABULARY, but it is not linked to a Controlled Vocabulary.', NEW.code;
end if;
end if;
RETURN NEW;
END;
$$ LANGUAGE 'plpgsql';
CREATE TRIGGER CONTROLLED_VOCABULARY_CHECK BEFORE INSERT OR UPDATE ON PROPERTY_TYPES
FOR EACH ROW EXECUTE PROCEDURE CONTROLLED_VOCABULARY_CHECK();
------------------------------------------------------------------------------------
-- Purpose: Create trigger EXTERNAL_DATA_STORAGE_FORMAT_CHECK
------------------------------------------------------------------------------------
CREATE OR REPLACE FUNCTION EXTERNAL_DATA_STORAGE_FORMAT_CHECK() RETURNS trigger AS $$
DECLARE
v_covo_code CODE;
data_code CODE;
BEGIN
select code into v_covo_code from controlled_vocabularies
where is_internal_namespace = true and
id = (select covo_id from controlled_vocabulary_terms where id = NEW.cvte_id_stor_fmt);
-- Check if the data storage format is a term of the controlled vocabulary "STORAGE_FORMAT"
if v_covo_code != 'STORAGE_FORMAT' then
select code into data_code from data where id = NEW.data_id;
RAISE EXCEPTION 'Insert/Update of Data (Code: %) failed, as its Storage Format is %, but is required to be STORAGE_FORMAT.', data_code, v_covo_code;
end if;
RETURN NEW;
END;
$$ LANGUAGE 'plpgsql';
CREATE TRIGGER EXTERNAL_DATA_STORAGE_FORMAT_CHECK BEFORE INSERT OR UPDATE ON EXTERNAL_DATA
FOR EACH ROW EXECUTE PROCEDURE EXTERNAL_DATA_STORAGE_FORMAT_CHECK();
------------------------------------------------------------------------------------
-- Purpose: Create trigger SAMPLE_CODE_UNIQUENESS_CHECK
------------------------------------------------------------------------------------
CREATE OR REPLACE FUNCTION SAMPLE_CODE_UNIQUENESS_CHECK() RETURNS trigger AS $$
DECLARE
counter INTEGER;
BEGIN
LOCK TABLE samples IN EXCLUSIVE MODE;
IF (NEW.samp_id_part_of is NULL) THEN
IF (NEW.dbin_id is not NULL) THEN
SELECT count(*) into counter FROM samples
where id != NEW.id and code = NEW.code and samp_id_part_of is NULL and dbin_id = NEW.dbin_id;
IF (counter > 0) THEN
RAISE EXCEPTION 'Insert/Update of Sample (Code: %) failed because database instance sample with the same code already exists.', NEW.code;
END IF;
ELSIF (NEW.grou_id is not NULL) THEN
SELECT count(*) into counter FROM samples
where id != NEW.id and code = NEW.code and samp_id_part_of is NULL and grou_id = NEW.grou_id;
IF (counter > 0) THEN
RAISE EXCEPTION 'Insert/Update of Sample (Code: %) failed because group sample with the same code already exists.', NEW.code;
END IF;
END IF;
ELSE
IF (NEW.dbin_id is not NULL) THEN
SELECT count(*) into counter FROM samples
where id != NEW.id and code = NEW.code and samp_id_part_of = NEW.samp_id_part_of and dbin_id = NEW.dbin_id;
IF (counter > 0) THEN
RAISE EXCEPTION 'Insert/Update of Sample (Code: %) failed because database instance sample with the same code and being the part of the same parent already exists.', NEW.code;
END IF;
ELSIF (NEW.grou_id is not NULL) THEN
SELECT count(*) into counter FROM samples
where id != NEW.id and code = NEW.code and samp_id_part_of = NEW.samp_id_part_of and grou_id = NEW.grou_id;
IF (counter > 0) THEN
RAISE EXCEPTION 'Insert/Update of Sample (Code: %) failed because group sample with the same code and being the part of the same parent already exists.', NEW.code;
END IF;
END IF;
END IF;
RETURN NEW;
END;
$$ LANGUAGE 'plpgsql';
CREATE TRIGGER SAMPLE_CODE_UNIQUENESS_CHECK BEFORE INSERT OR UPDATE ON SAMPLES
FOR EACH ROW EXECUTE PROCEDURE SAMPLE_CODE_UNIQUENESS_CHECK();
------------------------------------------------------------------------------------
-- Purpose: Create trigger MATERIAL/SAMPLE/EXPERIMENT/DATA_SET _PROPERTY_WITH_MATERIAL_DATA_TYPE_CHECK
-- It checks that if material property value is assigned to the entity,
-- then the material type is equal to the one described by property type.
------------------------------------------------------------------------------------
CREATE OR REPLACE FUNCTION MATERIAL_PROPERTY_WITH_MATERIAL_DATA_TYPE_CHECK() RETURNS trigger AS $$
DECLARE
v_type_id CODE;
v_type_id_prop CODE;
BEGIN
if NEW.mate_prop_id IS NOT NULL then
-- find material type id of the property type
select pt.maty_prop_id into v_type_id_prop
from material_type_property_types etpt, property_types pt
where NEW.mtpt_id = etpt.id AND etpt.prty_id = pt.id;
if v_type_id_prop IS NOT NULL then
-- find material type id of the material which consists the entity's property value
select entity.maty_id into v_type_id
from materials entity
where NEW.mate_prop_id = entity.id;
if v_type_id != v_type_id_prop then
RAISE EXCEPTION 'Insert/Update of property value referencing material (id: %) failed, as referenced material type is different than expected (id %, expected id: %).',
NEW.mate_prop_id, v_type_id, v_type_id_prop;
end if;
end if;
end if;
RETURN NEW;
END;
$$ LANGUAGE 'plpgsql';
CREATE TRIGGER MATERIAL_PROPERTY_WITH_MATERIAL_DATA_TYPE_CHECK BEFORE INSERT OR UPDATE ON material_properties
FOR EACH ROW EXECUTE PROCEDURE MATERIAL_PROPERTY_WITH_MATERIAL_DATA_TYPE_CHECK();
CREATE OR REPLACE FUNCTION SAMPLE_PROPERTY_WITH_MATERIAL_DATA_TYPE_CHECK() RETURNS trigger AS $$
DECLARE
v_type_id CODE;
v_type_id_prop CODE;
BEGIN
if NEW.mate_prop_id IS NOT NULL then
-- find material type id of the property type
select pt.maty_prop_id into v_type_id_prop
from sample_type_property_types etpt, property_types pt
where NEW.stpt_id = etpt.id AND etpt.prty_id = pt.id;
if v_type_id_prop IS NOT NULL then
-- find material type id of the material which consists the entity's property value
select entity.maty_id into v_type_id
from materials entity
where NEW.mate_prop_id = entity.id;
if v_type_id != v_type_id_prop then
RAISE EXCEPTION 'Insert/Update of property value referencing material (id: %) failed, as referenced material type is different than expected (id %, expected id: %).',
NEW.mate_prop_id, v_type_id, v_type_id_prop;
end if;
end if;
end if;
RETURN NEW;
END;
$$ LANGUAGE 'plpgsql';
CREATE TRIGGER SAMPLE_PROPERTY_WITH_MATERIAL_DATA_TYPE_CHECK BEFORE INSERT OR UPDATE ON sample_properties
FOR EACH ROW EXECUTE PROCEDURE SAMPLE_PROPERTY_WITH_MATERIAL_DATA_TYPE_CHECK();
CREATE OR REPLACE FUNCTION EXPERIMENT_PROPERTY_WITH_MATERIAL_DATA_TYPE_CHECK() RETURNS trigger AS $$
DECLARE
v_type_id CODE;
v_type_id_prop CODE;
BEGIN
if NEW.mate_prop_id IS NOT NULL then
-- find material type id of the property type
select pt.maty_prop_id into v_type_id_prop
from experiment_type_property_types etpt, property_types pt
where NEW.etpt_id = etpt.id AND etpt.prty_id = pt.id;
if v_type_id_prop IS NOT NULL then
-- find material type id of the material which consists the entity's property value
select entity.maty_id into v_type_id
from materials entity
where NEW.mate_prop_id = entity.id;
if v_type_id != v_type_id_prop then
RAISE EXCEPTION 'Insert/Update of property value referencing material (id: %) failed, as referenced material type is different than expected (id %, expected id: %).',
NEW.mate_prop_id, v_type_id, v_type_id_prop;
end if;
end if;
end if;
RETURN NEW;
END;
$$ LANGUAGE 'plpgsql';
CREATE TRIGGER EXPERIMENT_PROPERTY_WITH_MATERIAL_DATA_TYPE_CHECK BEFORE INSERT OR UPDATE ON experiment_properties
FOR EACH ROW EXECUTE PROCEDURE EXPERIMENT_PROPERTY_WITH_MATERIAL_DATA_TYPE_CHECK();
-- data set
CREATE OR REPLACE FUNCTION DATA_SET_PROPERTY_WITH_MATERIAL_DATA_TYPE_CHECK() RETURNS trigger AS $$
DECLARE
v_type_id CODE;
v_type_id_prop CODE;
BEGIN
if NEW.mate_prop_id IS NOT NULL then
-- find material type id of the property type
select pt.maty_prop_id into v_type_id_prop
from data_set_type_property_types dstpt, property_types pt
where NEW.dstpt_id = dstpt.id AND dstpt.prty_id = pt.id;
if v_type_id_prop IS NOT NULL then
-- find material type id of the material which consists the entity's property value
select entity.maty_id into v_type_id
from materials entity
where NEW.mate_prop_id = entity.id;
if v_type_id != v_type_id_prop then
RAISE EXCEPTION 'Insert/Update of property value referencing material (id: %) failed, as referenced material type is different than expected (id %, expected id: %).',
NEW.mate_prop_id, v_type_id, v_type_id_prop;
end if;
end if;
end if;
RETURN NEW;
END;
$$ LANGUAGE 'plpgsql';
CREATE TRIGGER DATA_SET_PROPERTY_WITH_MATERIAL_DATA_TYPE_CHECK BEFORE INSERT OR UPDATE ON data_set_properties
FOR EACH ROW EXECUTE PROCEDURE DATA_SET_PROPERTY_WITH_MATERIAL_DATA_TYPE_CHECK();
---------------------------------------------------------------------------------------------------
-- Purpose: Create DEFERRED triggers:
-- * check_dataset_relationships_on_data_table_modification,
-- * check_dataset_relationships_on_relationships_table_modification.
-- They check that after all modifications of database (just before commit)
-- if 'data'/'data_set_relationships' tables are among modified tables
-- dataset is not connected with a sample and a parent dataset at the same time.
-- This connections are held in two different tables so simple immediate trigger
-- with arc check cannot be used and we need two deferred triggers.
----------------------------------------------------------------------------------------------------
-- trigger for 'data' table
CREATE OR REPLACE FUNCTION check_dataset_relationships_on_data_table_modification() RETURNS trigger AS $$
DECLARE
counter INTEGER;
BEGIN
-- if there is a connection with a Sample there should not be any connection with a parent Data Set
IF (NEW.samp_id IS NOT NULL) THEN
-- count number of parents
SELECT count(*) INTO counter
FROM data_set_relationships
WHERE data_id_child = NEW.id;
IF (counter > 0) THEN
RAISE EXCEPTION 'Insert/Update of Data Set (Code: %) failed because it cannot be connected with a Sample and a parent Data Set at the same time.', NEW.code;
END IF;
END IF;
RETURN NEW;
END;
$$ LANGUAGE 'plpgsql';
CREATE CONSTRAINT TRIGGER check_dataset_relationships_on_data_table_modification
AFTER INSERT OR UPDATE ON data
DEFERRABLE INITIALLY DEFERRED
FOR EACH ROW
EXECUTE PROCEDURE check_dataset_relationships_on_data_table_modification();
-- trigger for 'data_set_relationships'
CREATE OR REPLACE FUNCTION check_dataset_relationships_on_relationships_table_modification() RETURNS trigger AS $$
DECLARE
counter INTEGER;
sample_id TECH_ID;
data_code CODE;
BEGIN
-- child will have a parent added so it should not be connected with any sample
SELECT samp_id, code INTO sample_id, data_code
FROM data
WHERE id = NEW.data_id_child;
IF (sample_id IS NOT NULL) THEN
RAISE EXCEPTION 'Insert/Update of Data Set (Code: %) failed because it cannot be connected to a Sample and to a parent Data Set at the same time.', data_code;
END IF;
RETURN NEW;
END;
$$ LANGUAGE 'plpgsql';
CREATE CONSTRAINT TRIGGER check_dataset_relationships_on_relationships_table_modification
AFTER INSERT OR UPDATE ON data_set_relationships
DEFERRABLE INITIALLY DEFERRED
FOR EACH ROW
EXECUTE PROCEDURE check_dataset_relationships_on_relationships_table_modification();
\ No newline at end of file
-- Granting SELECT privilege to group OPENBIS_READONLY
GRANT SELECT ON SEQUENCE attachment_content_id_seq TO GROUP OPENBIS_READONLY;
GRANT SELECT ON SEQUENCE attachment_id_seq TO GROUP OPENBIS_READONLY;
GRANT SELECT ON SEQUENCE code_seq TO GROUP OPENBIS_READONLY;
GRANT SELECT ON SEQUENCE controlled_vocabulary_id_seq TO GROUP OPENBIS_READONLY;
GRANT SELECT ON SEQUENCE cvte_id_seq TO GROUP OPENBIS_READONLY;
GRANT SELECT ON SEQUENCE data_id_seq TO GROUP OPENBIS_READONLY;
GRANT SELECT ON SEQUENCE data_set_property_id_seq TO GROUP OPENBIS_READONLY;
GRANT SELECT ON SEQUENCE data_set_relationship_id_seq TO GROUP OPENBIS_READONLY;
GRANT SELECT ON SEQUENCE data_set_type_id_seq TO GROUP OPENBIS_READONLY;
GRANT SELECT ON SEQUENCE data_store_id_seq TO GROUP OPENBIS_READONLY;
GRANT SELECT ON SEQUENCE DATA_STORE_SERVICES_ID_SEQ TO GROUP OPENBIS_READONLY;
GRANT SELECT ON SEQUENCE data_type_id_seq TO GROUP OPENBIS_READONLY;
GRANT SELECT ON SEQUENCE database_instance_id_seq TO GROUP OPENBIS_READONLY;
GRANT SELECT ON SEQUENCE dstpt_id_seq TO GROUP OPENBIS_READONLY;
GRANT SELECT ON SEQUENCE etpt_id_seq TO GROUP OPENBIS_READONLY;
GRANT SELECT ON SEQUENCE event_id_seq TO GROUP OPENBIS_READONLY;
GRANT SELECT ON SEQUENCE experiment_id_seq TO GROUP OPENBIS_READONLY;
GRANT SELECT ON SEQUENCE experiment_property_id_seq TO GROUP OPENBIS_READONLY;
GRANT SELECT ON SEQUENCE experiment_type_id_seq TO GROUP OPENBIS_READONLY;
GRANT SELECT ON SEQUENCE file_format_type_id_seq TO GROUP OPENBIS_READONLY;
GRANT SELECT ON SEQUENCE group_id_seq TO GROUP OPENBIS_READONLY;
GRANT SELECT ON SEQUENCE invalidation_id_seq TO GROUP OPENBIS_READONLY;
GRANT SELECT ON SEQUENCE locator_type_id_seq TO GROUP OPENBIS_READONLY;
GRANT SELECT ON SEQUENCE material_id_seq TO GROUP OPENBIS_READONLY;
GRANT SELECT ON SEQUENCE material_property_id_seq TO GROUP OPENBIS_READONLY;
GRANT SELECT ON SEQUENCE material_type_id_seq TO GROUP OPENBIS_READONLY;
GRANT SELECT ON SEQUENCE mtpt_id_seq TO GROUP OPENBIS_READONLY;
GRANT SELECT ON SEQUENCE perm_id_seq TO GROUP OPENBIS_READONLY;
GRANT SELECT ON SEQUENCE person_id_seq TO GROUP OPENBIS_READONLY;
GRANT SELECT ON SEQUENCE project_id_seq TO GROUP OPENBIS_READONLY;
GRANT SELECT ON SEQUENCE property_type_id_seq TO GROUP OPENBIS_READONLY;
GRANT SELECT ON SEQUENCE role_assignment_id_seq TO GROUP OPENBIS_READONLY;
GRANT SELECT ON SEQUENCE sample_id_seq TO GROUP OPENBIS_READONLY;
GRANT SELECT ON SEQUENCE sample_property_id_seq TO GROUP OPENBIS_READONLY;
GRANT SELECT ON SEQUENCE sample_type_id_seq TO GROUP OPENBIS_READONLY;
GRANT SELECT ON SEQUENCE stpt_id_seq TO GROUP OPENBIS_READONLY;
GRANT SELECT ON SEQUENCE authorization_group_id_seq TO GROUP OPENBIS_READONLY;
GRANT SELECT ON SEQUENCE filter_id_seq TO GROUP OPENBIS_READONLY;
GRANT SELECT ON SEQUENCE query_id_seq TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE attachment_contents TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE attachments TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE controlled_vocabularies TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE controlled_vocabulary_terms TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE data TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE data_set_properties TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE data_set_relationships TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE data_set_type_property_types TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE data_set_types TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE data_stores TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE data_types TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE DATA_STORE_SERVICES TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE DATA_STORE_SERVICE_DATA_SET_TYPES TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE database_instances TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE database_version_logs TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE events TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE experiment_properties TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE experiment_type_property_types TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE experiment_types TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE experiments TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE external_data TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE file_format_types TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE groups TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE invalidations TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE locator_types TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE material_properties TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE material_type_property_types TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE material_types TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE materials TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE persons TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE projects TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE property_types TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE role_assignments TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE sample_properties TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE sample_type_property_types TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE sample_types TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE samples TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE authorization_groups TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE authorization_group_persons TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE filters TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE queries TO GROUP OPENBIS_READONLY;
-- Migration from 051 to 052
-- add DB_KEY column to QUERIES
ALTER TABLE queries ADD COLUMN db_key code NOT NULL DEFAULT '1';
1 code\\011USER.description\\011study_Object\\011study_object_Type\\011project\\011processing_instructions\\011cell_plates\\012EXP5\\011A simple experiment\\011VIRUS1\\011VIRUS\\011YY\\011> processing-instructions.txt\\011> cellPlates.txt\\012EXP6\\011another experiment\\011VIRUS1\\011VIRUS\\011koko\\011\\011\\012
2 code\\011USER.description\\011study_Object\\011study_object_Type\\011project\\011processing_instructions\\011cell_plates\\012EXP5\\011A simple experiment\\011VIRUS1\\011VIRUS\\011YY\\011> processing-instructions.txt\\011> cellPlates.txt\\012EXP6\\011another experiment\\011VIRUS1\\011VIRUS\\011koko\\011\\011\\012
3 code\\011USER.description\\011study_Object\\011study_object_Type\\011project\\011processing_instructions\\011cell_plates\\012EXP5\\011A simple experiment\\011VIRUS1\\011VIRUS\\011YY\\011> processing-instructions.txt\\011> cellPlates.txt\\012EXP6\\011another experiment\\011VIRUS1\\011VIRUS\\011koko\\011\\011\\012
4 code\\011USER.description\\011study_Object\\011study_object_Type\\011project\\011processing_instructions\\011cell_plates\\012EXP5\\011A simple experiment\\011VIRUS1\\011VIRUS\\011YY\\011> processing-instructions.txt\\011> cellPlates.txt\\012EXP6\\011another experiment\\011VIRUS1\\011VIRUS\\011koko\\011\\011\\012
5 code\\011USER.description\\011study_Object\\011study_object_Type\\011project\\011processing_instructions\\011cell_plates\\012EXP5\\011A simple experiment\\011VIRUS1\\011VIRUS\\011YY\\011> processing-instructions.txt\\011> cellPlates.txt\\012EXP6\\011another experiment\\011VIRUS1\\011VIRUS\\011koko\\011\\011\\012
6 3VCP1\\0123VCP2\\0123VCP3
7 ala\\012ma\\012kota\\012a\\012kot\\012jest\\012idiota
1 2 exampleExperiments.txt 2008-12-10 13:48:17.996703+01 1 2 1 \N \N \N \N
2 2 exampleExperiments.txt 2008-12-10 13:49:14.564025+01 2 2 2 \N \N \N \N
3 2 exampleExperiments.txt 2008-12-10 13:49:20.23603+01 3 2 3 \N \N \N \N
4 2 exampleExperiments.txt 2008-12-10 13:49:27.90141+01 4 2 4 \N \N \N \N
5 8 exampleExperiments.txt 2008-12-10 13:49:48.879301+01 1 2 5 \N \N \N \N
6 8 cellPlates.txt 2008-12-10 13:51:10.050748+01 1 2 6 \N \N \N \N
7 \N sampleHistory.txt 2009-06-09 17:00:00+02 1 2 7 987 \N \N \N
1 PLATE_GEOMETRY The geometry or dimensions of a plate 2008-11-05 09:18:00.622+01 1 t t 1 2009-03-23 15:34:44.462776+01 t \N
2 STORAGE_FORMAT The on-disk storage format of a data set 2008-11-05 09:18:00.622+01 1 t t 1 2009-03-23 15:34:44.462776+01 t \N
3 ORGANISM available-organism 2008-11-05 09:18:30.327+01 2 f f 1 2009-03-23 15:34:44.462776+01 t \N
4 GENDER \N 2008-11-05 09:18:30.421+01 2 f f 1 2009-03-23 15:34:44.462776+01 t \N
5 HUMAN Humans 2008-11-05 09:18:30.983+01 2 f f 1 2009-03-23 15:34:44.462776+01 t \N
1 96_WELLS_8X12 2008-11-05 09:18:00.622+01 1 1 \N \N 1
2 384_WELLS_16X24 2008-11-05 09:18:00.622+01 1 1 \N \N 2
3 1536_WELLS_32X48 2008-11-05 09:18:00.622+01 1 1 \N \N 3
4 PROPRIETARY 2008-11-05 09:18:00.622+01 2 1 \N \N 1
5 BDS_DIRECTORY 2008-11-05 09:18:00.622+01 2 1 \N \N 2
6 RAT 2008-11-05 09:18:30.327+01 3 2 \N \N 1
7 DOG 2008-11-05 09:18:30.327+01 3 2 \N \N 2
8 HUMAN 2008-11-05 09:18:30.327+01 3 2 \N \N 3
9 GORILLA 2008-11-05 09:18:30.327+01 3 2 \N \N 4
10 FLY 2008-11-05 09:18:30.327+01 3 2 \N \N 5
11 MALE 2008-11-05 09:18:30.421+01 4 2 \N \N 1
12 FEMALE 2008-11-05 09:18:30.421+01 4 2 \N \N 2
13 MAN 2008-11-05 09:18:30.983+01 5 2 \N \N 1
14 WOMAN 2008-11-05 09:18:30.983+01 5 2 \N \N 2
15 CHILD 2008-11-05 09:18:31.061+01 5 2 \N \N 3
2 20081105092158673-1 2 \N 2008-11-05 09:21:58.688+01 2008-11-05 09:21:58.798+01 f t 2009-03-23 15:34:44.462776+01 2 1 f 982
4 20081105092159188-3 2 \N 2008-11-05 09:21:59.203+01 2008-11-05 09:21:59.313+01 f t 2009-03-23 15:34:44.462776+01 2 1 t \N
5 20081105092159111-1 2 \N 2008-11-05 09:21:59.203+01 2009-02-09 12:20:21.646654+01 f t 2009-03-23 15:34:44.462776+01 18 1 f 1042
6 20081105092159222-2 2 \N 2008-11-05 09:21:59.203+01 2009-02-09 12:21:11.479816+01 f t 2009-03-23 15:34:44.462776+01 19 1 f 1043
7 20081105092159333-3 2 \N 2008-11-05 09:21:59.203+01 2009-02-09 12:21:47.815468+01 f t 2009-03-23 15:34:44.462776+01 20 1 f 1044
8 20081105092259000-8 2 \N 2008-11-05 09:22:59.203+01 2008-11-05 09:22:59.313+01 f t 2009-03-23 15:34:44.462776+01 8 1 t \N
9 20081105092259000-9 2 \N 2008-11-05 09:22:59.203+01 2008-11-05 09:22:59.313+01 f t 2009-03-23 15:34:44.462776+01 8 1 t \N
10 20081105092259900-0 2 \N 2008-11-05 09:22:59.203+01 2008-11-05 09:22:59.313+01 f t 2009-03-23 15:34:44.462776+01 8 1 t \N
11 20081105092259900-1 2 \N 2008-11-05 09:22:59.203+01 2008-11-05 09:22:59.313+01 f t 2009-03-23 15:34:44.462776+01 8 1 t \N
12 20081105092359990-2 2 \N 2008-11-05 09:22:59.203+01 2008-11-05 09:22:59.313+01 f t 2009-03-23 15:34:44.462776+01 8 1 t \N
1 2 1 no comment \N \N 2 2009-04-24 14:45:06.348563+02 2009-04-24 14:45:07.085+02
2 4 1 no comment \N \N 2 2009-04-24 14:45:06.348563+02 2009-04-24 14:45:07.089+02
3 5 1 no comment \N \N 2 2009-04-24 14:45:06.348563+02 2009-04-24 14:45:07.09+02
4 6 1 no comment \N \N 2 2009-04-24 14:45:06.348563+02 2009-04-24 14:45:07.09+02
5 7 1 no comment \N \N 2 2009-04-24 14:45:06.348563+02 2009-04-24 14:45:07.091+02
6 8 1 no comment \N \N 2 2009-04-24 14:45:06.348563+02 2009-04-24 14:45:07.091+02
7 9 1 no comment \N \N 2 2009-04-24 14:45:06.348563+02 2009-04-24 14:45:07.091+02
8 10 1 no comment \N \N 2 2009-04-24 14:45:06.348563+02 2009-04-24 14:45:07.091+02
9 11 1 no comment \N \N 2 2009-04-24 14:45:06.348563+02 2009-04-24 14:45:07.091+02
10 12 1 no comment \N \N 2 2009-04-24 14:45:06.348563+02 2009-04-24 14:45:07.091+02
11 5 4 \N 12 \N 2 2009-09-15 08:45:48.059548+02 2009-09-15 08:45:48.639+02
12 5 3 \N \N 22 2 2009-09-15 08:45:48.059548+02 2009-09-15 08:45:48.64+02
13 5 2 \N \N 2498 2 2009-09-15 08:45:48.059548+02 2009-09-15 08:45:48.64+02
2 4
7 8
2 9
5 9
6 9
7 9
9 10
9 11
10 12
11 12
1 2 14 t f 2 2009-04-24 14:45:06.348563+02 \N 1
2 2 26 f f 2 2009-09-15 08:44:10.351183+02 \N 2
3 2 25 f f 2 2009-09-15 08:44:16.365221+02 \N 3
4 2 13 f f 2 2009-09-15 08:44:36.342115+02 \N 4
1 UNKNOWN Unknown 1 2009-03-23 15:34:44.462776+01 \N \N
2 HCS_IMAGE High Content Screening Image 1 2009-03-23 15:34:44.462776+01 \N \N
3 HCS_IMAGE_ANALYSIS_DATA Data derived from analysis of HCS images 1 2009-03-23 15:34:44.462776+01 \N \N
1 1 STANDARD 2008-11-05 09:18:00.622+01 2009-04-09 09:36:34.982+02 f
1 VARCHAR Variable length character
2 INTEGER Integer
3 REAL Real number, i.e. an inexact, variable-precision numeric type
4 BOOLEAN An enumerated type with values True and False
5 TIMESTAMP Both date and time. Format: yyyy-mm-dd hh:mm:ss
6 CONTROLLEDVOCABULARY Controlled Vocabulary
7 MATERIAL Reference to a material
8 HYPERLINK Address of a web page
9 MULTILINE_VARCHAR Long text
1 CISD 57F0FA8F-80AC-42AB-9C6A-AAADBCC37A3E t 2008-11-05 09:18:00.622+01
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment