From 1b9bf1aff164ce150c3fa2b777b68aaa02e0c06d Mon Sep 17 00:00:00 2001 From: felmer <felmer> Date: Thu, 21 Mar 2013 14:52:11 +0000 Subject: [PATCH] SP-568, BIS-365: Add sample type and experiment type UNKNOWN, space, project, experiment, and sample DEFAULT SVN: 28668 --- openbis/source/sql/generic/133/data-133.sql | 114 ++++++++++++++++++++ 1 file changed, 114 insertions(+) diff --git a/openbis/source/sql/generic/133/data-133.sql b/openbis/source/sql/generic/133/data-133.sql index a07fc0f986b..85c0fead6ca 100644 --- a/openbis/source/sql/generic/133/data-133.sql +++ b/openbis/source/sql/generic/133/data-133.sql @@ -204,6 +204,38 @@ values ,(select id from database_instances where code = 'SYSTEM_DEFAULT') ); +-------------------------------------------------------------------------- +-- Purpose: Insert an initial data set into the table EXPERIMENT_TYPES +-------------------------------------------------------------------------- + +insert into experiment_types +(id +,code +,description +,dbin_id) +values +(nextval('EXPERIMENT_TYPE_ID_SEQ') +,'UNKNOWN' +,'Unknown' +,(select id from database_instances where code = 'SYSTEM_DEFAULT') +); + +-------------------------------------------------------------------------- +-- Purpose: Insert an initial data set into the table SAMPLE_TYPES +-------------------------------------------------------------------------- + +insert into sample_types +(id +,code +,description +,dbin_id) +values +(nextval('SAMPLE_TYPE_ID_SEQ') +,'UNKNOWN' +,'Unknown' +,(select id from database_instances where code = 'SYSTEM_DEFAULT') +); + -------------------------------------------------------------------------- -- Purpose: Insert an initial data set into the table DATA_SET_TYPES -------------------------------------------------------------------------- @@ -364,4 +396,86 @@ nextval('RELATIONSHIP_TYPE_ID_SEQ'), (select id from database_instances where code = 'SYSTEM_DEFAULT') ); +--------------------------------------------------------------------- +-- Purpose: Create default space +--------------------------------------------------------------------- + +insert into spaces +(id, +code, +dbin_id, +pers_id_registerer) +values +( +nextval('SPACE_ID_SEQ'), +'DEFAULT', +(select id from database_instances where code = 'SYSTEM_DEFAULT'), +(select id from persons where user_id ='system') +); + +--------------------------------------------------------------------- +-- Purpose: Create default project +--------------------------------------------------------------------- + +select nextval('PROJECT_ID_SEQ'); +insert into projects +(id, +perm_id, +code, +space_id, +pers_id_registerer) +values +( +currval('PROJECT_ID_SEQ'), +to_char(now(), 'YYYYMMDDHH24MISSMS')||'-'||currval('PROJECT_ID_SEQ'), +'DEFAULT', +(select id from spaces where code = 'DEFAULT'), +(select id from persons where user_id ='system') +); + +--------------------------------------------------------------------- +-- Purpose: Create default experiment +--------------------------------------------------------------------- + +select nextval('EXPERIMENT_ID_SEQ'); +insert into experiments_all +(id, +perm_id, +code, +proj_id, +exty_id, +pers_id_registerer) +values +( +currval('EXPERIMENT_ID_SEQ'), +to_char(now(), 'YYYYMMDDHH24MISSMS')||'-'||currval('EXPERIMENT_ID_SEQ'), +'DEFAULT', +(select id from projects where code = 'DEFAULT'), +(select id from experiment_types where code = 'UNKNOWN'), +(select id from persons where user_id ='system') +); + +--------------------------------------------------------------------- +-- Purpose: Create default sample +--------------------------------------------------------------------- + +select nextval('SAMPLE_ID_SEQ'); +insert into samples_all +(id, +perm_id, +code, +expe_id, +space_id, +saty_id, +pers_id_registerer) +values +( +currval('SAMPLE_ID_SEQ'), +to_char(now(), 'YYYYMMDDHH24MISSMS')||'-'||currval('SAMPLE_ID_SEQ'), +'DEFAULT', +(select id from experiments where code = 'DEFAULT'), +(select id from spaces where code = 'DEFAULT'), +(select id from sample_types where code = 'UNKNOWN'), +(select id from persons where user_id ='system') +); -- GitLab