Commit c9566fc1 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

translation of migration scripts for hsql (minerva version 10)

parent e42f9887
-- remove metaid columns (some useless identifier)
alter table species_table drop column metaid;
alter table reaction_table drop column metaid;
alter table model_table drop column metaid;
insert into changelog (svnversion, description, type, requestproject_iddb, requestuser_iddb) values
(1024, 'Search by reaction id is not case sensitive', 'BUG_FIX', null,
(select iddb from external_user where email ='alberto.noronha@uni.lu'));
insert into changelog (svnversion, description, type, requestproject_iddb, requestuser_iddb) values
(1024, 'CellDesigner font size is processed properly', 'BUG_FIX', null,
(select iddb from external_user where email ='marek.ostaszewski@uni.lu'));
--column with input file data for a project
alter table project_table add column inputdata binary;
ALTER TABLE project_table ADD COLUMN inputfilename varchar(1024);
\ No newline at end of file
insert into changelog (svnversion, description, type, requestproject_iddb, requestuser_iddb) values
(1024, 'Project info tab available for users', 'FUNCTIONALITY', null,
(select iddb from external_user where email ='piotr.gawron@uni.lu'));
INSERT INTO cache_type(iddb, validity, classname)
VALUES (19, 28, 'lcsb.mapviewer.annotation.services.genome.UcscReferenceGenomeConnector');
CREATE SEQUENCE public.big_file_entry_iddb_seq
INCREMENT by 1
MINVALUE 1
no MAXVALUE
START with 1;
CREATE TABLE public.big_file_entry
(
iddb integer GENERATED BY DEFAULT AS SEQUENCE big_file_entry_iddb_seq NOT NULL,
url clob,
localpath clob,
downloaddate timestamp without time zone,
downloadprogress double precision,
downloadthreadid integer,
removed boolean default false,
CONSTRAINT big_file_entry_pkey PRIMARY KEY (iddb)
);
drop table if exists public.reference_genome;
drop SEQUENCE if exists public.reference_genome_iddb_seq;
CREATE SEQUENCE public.reference_genome_iddb_seq
INCREMENT by 1
MINVALUE 1
no MAXVALUE
START with 1;
CREATE TABLE public.reference_genome
(
iddb integer GENERATED BY DEFAULT AS SEQUENCE reference_genome_iddb_seq NOT NULL,
organism_iddb integer NOT NULL ,
"type" varchar(255),
version varchar(255),
sourceurl clob,
downloadprogress double precision,
CONSTRAINT reference_genome_pkey PRIMARY KEY (iddb),
CONSTRAINT reference_genome_organism_fk FOREIGN KEY (organism_iddb)
REFERENCES public.miriam_data_table (iddb) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
);
--obligatory fields for reference genome table
alter table reference_genome alter column "type" set not null;
alter table reference_genome alter column organism_iddb set not null;
alter table reference_genome alter column version set not null;
--gene mapping files table for reference genome table
drop table if exists public.reference_genome_gene_mapping;
drop SEQUENCE if exists public.reference_genome_gene_mapping_iddb_seq;
CREATE SEQUENCE public.reference_genome_gene_mapping_iddb_seq
INCREMENT by 1
MINVALUE 1
no MAXVALUE
START with 1;
CREATE TABLE public.reference_genome_gene_mapping
(
iddb integer GENERATED BY DEFAULT AS SEQUENCE reference_genome_gene_mapping_iddb_seq NOT NULL,
referencegenome_iddb integer NOT NULL,
name varchar(255) not null,
sourceurl clob not null,
downloadprogress double precision,
CONSTRAINT reference_genome_gene_mapping_pkey PRIMARY KEY (iddb),
CONSTRAINT reference_genome_gene_mapping_reference_genome_fk FOREIGN KEY (referencegenome_iddb)
REFERENCES public.reference_genome (iddb) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT reference_genome_gene_mapping_unique_name UNIQUE (referencegenome_iddb, name)
);
-- fixing privileges for admin (genome managing is availabvle by default for admin)
insert into privilege_table (privilege_class_type_db,level,type,idobject,user_iddb) select 'BASIC_PRIVILEGE',1,11,null, t.iddb from user_table t where iddb=1 and not(t.iddb in (select user_iddb from privilege_table where type=11));
-- project should have organism id
alter table project_table add column organism_iddb integer;
ALTER TABLE project_table ADD CONSTRAINT project_organism_constraint FOREIGN KEY (organism_iddb)
REFERENCES public.miriam_data_table (iddb) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION;
\ No newline at end of file
-- reorganizing files in the system
alter table big_file_entry rename to file_entry;
alter table file_entry add column filecontent binary;
alter table file_entry add column file_type_db varchar(255);
alter table file_entry add column originalfilename varchar(255);
-- all files up to this point were big files
update file_entry set file_type_db = 'BIG_FILE_ENTRY';
--and now we move content of files from layout file to file_entry table
--tmp column
alter table file_entry add column layout_id_tmp integer;
--move content content
insert into file_entry (filecontent,file_type_db,originalfilename,layout_id_tmp) select inputdata, 'UPLOADED_FILE_ENTRY', 'layout_'||iddb||'.txt',iddb from layout where inputdata is not null;
--add foreign key
alter table layout add column file_entry_iddb integer;
ALTER TABLE layout ADD CONSTRAINT layout_file_constraint FOREIGN KEY (file_entry_iddb)
REFERENCES public.file_entry (iddb) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION;
--put data to foreign key
update layout l set file_entry_iddb = (select iddb from file_entry ef where ef.layout_id_tmp = l.iddb) where l.inputdata is not null;
--remove unused columns
alter table file_entry drop column layout_id_tmp;
alter table layout drop column inputdata;
insert into changelog (svnversion, description, type, requestproject_iddb, requestuser_iddb) values
(1024, 'Hiding left panel', 'BUG_FIX', null,
(select iddb from external_user where email ='alberto.noronha@uni.lu'));
insert into changelog (svnversion, description, type, requestproject_iddb, requestuser_iddb) values
(1024, 'Coordinates in url', 'BUG_FIX', null,
(select iddb from external_user where email ='alberto.noronha@uni.lu'));
insert into changelog (svnversion, description, type, requestproject_iddb, requestuser_iddb) values
(1024, 'Unexpected errors when uploading layouts', 'BUG_FIX', null,
(select iddb from external_user where email ='alberto.noronha@uni.lu'));
delete from cachequery where type = (select iddb from cache_type where classname = 'lcsb.mapviewer.annotation.services.DrugbankHTMLParser') and query like 'drug:%';
insert into changelog (svnversion, description, type, requestproject_iddb, requestuser_iddb) values
(1024, 'Corrupted drug names', 'BUG_FIX', null,
(select iddb from external_user where email ='alberto.noronha@uni.lu'));
insert into changelog (svnversion, description, type, requestproject_iddb, requestuser_iddb) values
(1049, 'Out of memory when caching a lot of data', 'BUG_FIX', null,
(select iddb from external_user where email ='marek.ostaszewski@uni.lu'));
insert into changelog (svnversion, description, type, requestproject_iddb, requestuser_iddb) values
(1049, 'Management of overlays in admin panel', 'FUNCTIONALITY', null,
(select iddb from external_user where email ='marek.ostaszewski@uni.lu'));
insert into changelog (svnversion, description, type, requestproject_iddb, requestuser_iddb) values
(1049, 'Zooming issue when searching for results on submaps', 'BUG_FIX', null,
(select iddb from external_user where email ='piotr.gawron@uni.lu'));
insert into changelog (svnversion, description, type, requestproject_iddb, requestuser_iddb) values
(1049, 'Exception when accessing non-existing project', 'BUG_FIX', null,
(select iddb from external_user where email ='piotr.gawron@uni.lu'));
insert into changelog (svnversion, description, type, requestproject_iddb, requestuser_iddb) values
(1056, 'Visualization of text mining', 'BUG_FIX', null,
(select iddb from external_user where email ='marek.ostaszewski@uni.lu'));
insert into framework_version(version,"time", svnversion) values (10, timestamp'2016-08-22',1119);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment