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

translation of postgres sql into hsql for version 7

parent c170114f
update species_table set hypothetical=false where hypothetical is null;
\ No newline at end of file
ALTER TABLE model_table
ADD COLUMN idmodel character varying(255);
ALTER TABLE model_table
ADD COLUMN metaid character varying(255);
create table history_table (
iddb INTEGER IDENTITY PRIMARY KEY,
query varchar(1024),
map varchar(255),
timestamp timestamp without time zone,
type integer,
ipaddress varchar(255)
);
\ No newline at end of file
-- change cache query
ALTER TABLE cachequery ADD COLUMN type integer;
update cachequery set type =0 where substring (query from 0 for position(chr(10) in query)) = 'lcsb.mapviewer.reactome.model.ReactomeCandidateSet';
update cachequery set type =0 where substring (query from 0 for position(chr(10) in query)) = 'lcsb.mapviewer.reactome.model.ReactomeCatalystActivity';
update cachequery set type =0 where substring (query from 0 for position(chr(10) in query)) = 'lcsb.mapviewer.reactome.model.ReactomeComplex';
update cachequery set type =0 where substring (query from 0 for position(chr(10) in query)) = 'lcsb.mapviewer.reactome.model.ReactomeDatabaseObject';
update cachequery set type =0 where substring (query from 0 for position(chr(10) in query)) = 'lcsb.mapviewer.reactome.model.ReactomeEntitySet';
update cachequery set type =0 where substring (query from 0 for position(chr(10) in query)) = 'lcsb.mapviewer.reactome.model.ReactomeEntityWithAccessionedSequence';
update cachequery set type =0 where substring (query from 0 for position(chr(10) in query)) = 'lcsb.mapviewer.reactome.model.ReactomeEvent';
update cachequery set type =0 where substring (query from 0 for position(chr(10) in query)) = 'lcsb.mapviewer.reactome.model.ReactomeLiteratureReference';
update cachequery set type =0 where substring (query from 0 for position(chr(10) in query)) = 'lcsb.mapviewer.reactome.model.ReactomePhysicalEntity';
update cachequery set type =0 where substring (query from 0 for position(chr(10) in query)) = 'lcsb.mapviewer.reactome.model.ReactomeReactionlikeEvent';
update cachequery set type =0 where substring (query from 0 for position(chr(10) in query)) = 'lcsb.mapviewer.reactome.model.ReactomeReferenceMolecule';
update cachequery set type =0 where substring (query from 0 for position(chr(10) in query)) = 'lcsb.mapviewer.reactome.model.ReactomeReferenceSequence';
update cachequery set type =0 where substring (query from 0 for position(chr(10) in query)) = 'lcsb.mapviewer.reactome.model.ReactomeSimpleEntity';
update cachequery set type =0 where substring (query from 0 for position(chr(10) in query)) = 'lcsb.mapviewer.reactome.model.ReactomeStableIdentifier';
update cachequery set type =1 where substring (query from 0 for position(chr(10) in query)) = 'lcsb.mapviewer.utils.annotation.AnnotationRestService';
update cachequery set type =2 where substring (query from 0 for position(chr(10) in query)) = 'lcsb.mapviewer.utils.annotation.ChEMBLParser';
update cachequery set type =3 where substring (query from 0 for position(chr(10) in query)) = 'lcsb.mapviewer.utils.annotation.data.Article';
update cachequery set type =4 where substring (query from 0 for position(chr(10) in query)) = 'lcsb.mapviewer.utils.annotation.DrugbankHTMLParser';
update cachequery set type =5 where substring (query from 0 for position(chr(10) in query)) = 'lcsb.mapviewer.utils.annotation.IdConverter';
ALTER TABLE cachequery ALTER COLUMN type set not null;
update cachequery set query= substring(query from position(chr(10) in query)+1) where position(chr(10) in query)>0;
ALTER TABLE cachequery ADD COLUMN expires timestamp without time zone;
update cachequery set expires = accessed + 42 day;
-- and now entry
drop table cacheentry;
-- set auto increment id
CREATE SEQUENCE cacheentry_iddb_seq
INCREMENT BY 1
MINVALUE 1
NO MAXVALUE
START WITH 1;
CREATE TABLE cacheentry (
iddb integer GENERATED BY DEFAULT AS SEQUENCE cacheentry_iddb_seq NOT NULL,
accessed timestamp without time zone,
type integer not null,
expires timestamp without time zone,
customid integer,
value CLOB
);
--create search index
CREATE INDEX query_index
ON cachequery (type, query);
ALTER TABLE layout ADD COLUMN creator_iddb integer;
ALTER TABLE layout ADD COLUMN publiclayout boolean;
update layout set publiclayout=true;
alter table alias_table drop column maxvisibilitylevel;
alter table alias_table drop column minvisibilitylevel;
alter table alias_table add column transparencyLevel numeric;
update alias_table set transparencyLevel=0;
\ No newline at end of file
CREATE SEQUENCE configuration_table_iddb_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE;
CREATE TABLE configuration_table (
iddb integer GENERATED BY DEFAULT AS SEQUENCE configuration_table_iddb_seq NOT NULL,
type integer,
value character varying(255)
);
ALTER TABLE configuration_table
ADD CONSTRAINT configuration_table_pkey PRIMARY KEY (iddb);
alter table layout add column progress double precision;
alter table layout add column status integer;
update layout set progress =0.0, status =0;
\ No newline at end of file
alter table species_table add column fullname varchar(255);
alter table species_table add column symbol varchar(255);
drop table if exists element_synonyms;
create table element_synonyms (
iddb integer,
idx integer,
synonym varchar(255),
CONSTRAINT element_synonyms_pkey PRIMARY KEY (iddb, idx),
CONSTRAINT element_synonyms_fkey FOREIGN KEY (iddb)
REFERENCES species_table (iddb) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
);
drop table if exists element_former_symbols;
create table element_former_symbols (
iddb integer,
idx integer,
symbol varchar(255),
CONSTRAINT element_former_symbols_pkey PRIMARY KEY (iddb, idx),
CONSTRAINT element_former_symbols_fkey FOREIGN KEY (iddb)
REFERENCES species_table (iddb) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
);
alter table species_table add column smiles clob;
alter table species_table add column inchi clob;
alter table species_table add column inchikey varchar(255);
CREATE SEQUENCE associated_phenotype_element_table_iddb_seq
INCREMENT by 1
MINVALUE 1
no MAXVALUE
START with 1;
CREATE TABLE associated_phenotype_element_table
(
iddb integer GENERATED BY DEFAULT AS SEQUENCE associated_phenotype_element_table_iddb_seq NOT NULL,
source integer,
data_iddb integer,
phenotype_iddb integer,
CONSTRAINT associated_phenotype_element_table_pkey PRIMARY KEY (iddb),
CONSTRAINT associated_phenotype_element_table_fk FOREIGN KEY (data_iddb)
REFERENCES miriam_data_table (iddb) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT associated_phenotype_element_table_fk2 FOREIGN KEY (phenotype_iddb)
REFERENCES species_table (iddb) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
);
alter table model_table alter column shortdescription clob;
alter table model_table alter column notes clob;
delete from cachequery where type =7 and query like 'id:%';
\ No newline at end of file
alter table model_table add column notifyemail varchar(255);
alter table layout add column description clob;
update alias_table set alias_type_db='Artificial Compartment Alias' WHERE alias_type_db='Artifitial Compartment Alias';
\ No newline at end of file
update node_table set reaction_iddb=parent_iddb where reaction_iddb is null;
alter table node_table drop column parent_iddb;
\ No newline at end of file
alter table layout add column hierarchicalview boolean default false;
\ No newline at end of file
CREATE SEQUENCE cache_type_iddb_seq
INCREMENT by 1
MINVALUE 1
no MAXVALUE
START with 10;
CREATE TABLE cache_type
(
iddb integer GENERATED BY DEFAULT AS SEQUENCE cache_type_iddb_seq NOT NULL,
validity integer,
classname varchar(255),
CONSTRAINT cache_type_pkey PRIMARY KEY (iddb)
);
INSERT INTO cache_type VALUES (1, 28, 'lcsb.mapviewer.reactome.utils.ReactomeConnector');
INSERT INTO cache_type VALUES (2, 28, 'lcsb.mapviewer.annotation.services.AnnotationRestService');
INSERT INTO cache_type VALUES (3, 28, 'lcsb.mapviewer.annotation.services.ChEMBLParser');
INSERT INTO cache_type VALUES (4, 365, 'lcsb.mapviewer.annotation.services.PubmedParser');
INSERT INTO cache_type VALUES (5, 28, 'lcsb.mapviewer.annotation.services.DrugbankHTMLParser');
INSERT INTO cache_type VALUES (6, 28, 'lcsb.mapviewer.annotation.services.IdConverter');
INSERT INTO cache_type VALUES (7, -1, 'lcsb.mapviewer.annotation.cache.MockCacheInterface');
INSERT INTO cache_type VALUES (8, 28, 'lcsb.mapviewer.annotation.services.ChebiBackend');
INSERT INTO cache_type VALUES (9, 28, 'lcsb.mapviewer.annotation.services.GoBackend');
--fix rna regions
CREATE SEQUENCE rna_region_table_idrnaregiondb_seq
INCREMENT by 1
MINVALUE 1
no MAXVALUE
START with 1;
CREATE TABLE rna_region_table
(
iddb integer GENERATED BY DEFAULT AS SEQUENCE rna_region_table_idrnaregiondb_seq NOT NULL,
idrnaregion character varying(255),
name character varying(255),
pos double precision,
size double precision,
type character varying(255),
state character varying(255),
idspeciesdb integer,
CONSTRAINT rna_region_table_pkey PRIMARY KEY (iddb),
CONSTRAINT rna_region_species_iddb_fk FOREIGN KEY (idspeciesdb)
REFERENCES species_table (iddb) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
);
-- fix state in protein modifications
alter table modification_residue_table ADD COLUMN state_int integer;
update modification_residue_table set state_int = 0 where state='phosphorylated';
update modification_residue_table set state_int = 1 where state='acetylated';
update modification_residue_table set state_int = 2 where state='ubiquitinated';
update modification_residue_table set state_int = 3 where state='methylated';
update modification_residue_table set state_int = 4 where state='hydroxylated';
update modification_residue_table set state_int = 5 where state='myristoylated';
update modification_residue_table set state_int = 6 where state='sulfated';
update modification_residue_table set state_int = 7 where state='prenylated';
update modification_residue_table set state_int = 8 where state='glycosylated';
update modification_residue_table set state_int = 9 where state='palmytoylated';
update modification_residue_table set state_int = 10 where state='unknown';
update modification_residue_table set state_int = 11 where state='protonated';
update modification_residue_table set state_int = 12 where state='don''t care';
alter table modification_residue_table drop column state;
alter table modification_residue_table alter column state_int rename to state;
-- fix state in rna regions
alter table rna_region_table ADD COLUMN state_int integer;
update rna_region_table set state_int = 0 where state='phosphorylated';
update rna_region_table set state_int = 1 where state='acetylated';
update rna_region_table set state_int = 2 where state='ubiquitinated';
update rna_region_table set state_int = 3 where state='methylated';
update rna_region_table set state_int = 4 where state='hydroxylated';
update rna_region_table set state_int = 5 where state='myristoylated';
update rna_region_table set state_int = 6 where state='sulfated';
update rna_region_table set state_int = 7 where state='prenylated';
update rna_region_table set state_int = 8 where state='glycosylated';
update rna_region_table set state_int = 9 where state='palmytoylated';
update rna_region_table set state_int = 10 where state='unknown';
update rna_region_table set state_int = 11 where state='protonated';
update rna_region_table set state_int = 12 where state='don''t care';
alter table rna_region_table drop column state;
alter table rna_region_table alter column state_int rename to state;
-- fix state in antisense rna regions
alter table antisense_rna_region_table ADD COLUMN state_int integer;
update antisense_rna_region_table set state_int = 0 where state='phosphorylated';
update antisense_rna_region_table set state_int = 1 where state='acetylated';
update antisense_rna_region_table set state_int = 2 where state='ubiquitinated';
update antisense_rna_region_table set state_int = 3 where state='methylated';
update antisense_rna_region_table set state_int = 4 where state='hydroxylated';
update antisense_rna_region_table set state_int = 5 where state='myristoylated';
update antisense_rna_region_table set state_int = 6 where state='sulfated';
update antisense_rna_region_table set state_int = 7 where state='prenylated';
update antisense_rna_region_table set state_int = 8 where state='glycosylated';
update antisense_rna_region_table set state_int = 9 where state='palmytoylated';
update antisense_rna_region_table set state_int = 10 where state='unknown';
update antisense_rna_region_table set state_int = 11 where state='protonated';
update antisense_rna_region_table set state_int = 12 where state='don''t care';
alter table antisense_rna_region_table drop column state;
alter table antisense_rna_region_table alter column state_int rename to state;
--change names in antisense rna regions identifiers
alter table antisense_rna_region_table alter column idAntisenseRnaRegionDb rename to iddb;
alter table antisense_rna_region_table alter column id rename to idantisensernaregion;
-- fix type in antisense rna region
alter table antisense_rna_region_table ADD COLUMN type_int integer;
update antisense_rna_region_table set type_int = 0 where type='Modification Site';
update antisense_rna_region_table set type_int = 1 where type='CodingRegion';
update antisense_rna_region_table set type_int = 2 where type='proteinBindingDomain';
alter table antisense_rna_region_table drop column type;
alter table antisense_rna_region_table alter column type_int rename to type;
--change names in modification residue db identifiers
alter table modification_residue_table alter column idModificationResidueDb rename to iddb;
alter table modification_residue_table alter column id rename to idModificationResidue;
-- fix comments table
update feedback set tablename='lcsb.mapviewer.model.map.reaction.type.StateTransitionReaction' where tablename='lcsb.mapviewer.db.model.map.reaction.type.StateTransitionReaction';
update feedback set tablename='lcsb.mapviewer.model.map.reaction.type.TransportReaction' where tablename='lcsb.mapviewer.db.model.map.reaction.type.TransportReaction';
update feedback set tablename='lcsb.mapviewer.model.map.layout.alias.SpeciesAlias' where tablename='lcsb.mapviewer.db.model.map.layout.alias.SpeciesAlias';
update feedback set tablename='lcsb.mapviewer.model.map.reaction.type.UnknownTransitionReaction' where tablename='lcsb.mapviewer.db.model.map.reaction.type.UnknownTransitionReaction';
--fix cache
update cache_type set iddb = 0 where classname='lcsb.mapviewer.reactome.utils.ReactomeConnector';
update cache_type set iddb = 1 where classname='lcsb.mapviewer.annotation.services.AnnotationRestService';
update cache_type set iddb = 2 where classname='lcsb.mapviewer.annotation.services.ChEMBLParser';
update cache_type set iddb = 3 where classname='lcsb.mapviewer.annotation.services.PubmedParser';
update cache_type set iddb = 4 where classname='lcsb.mapviewer.annotation.services.DrugbankHTMLParser';
update cache_type set iddb = 5 where classname='lcsb.mapviewer.annotation.services.IdConverter';
update cache_type set iddb = 6 where classname='lcsb.mapviewer.annotation.cache.MockCacheInterface';
update cache_type set iddb = 7 where classname='lcsb.mapviewer.annotation.services.ChebiBackend';
update cache_type set iddb = 8 where classname='lcsb.mapviewer.annotation.services.GoBackend';
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