Skip to content
Snippets Groups Projects
Commit 543aaba7 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

fixed slq migration files

parent 17024faa
No related branches found
No related tags found
1 merge request!116merge of initial development of 11.1.x version
...@@ -12,7 +12,7 @@ update element_table set alias_type_db ='Right square Compartment' where alias_t ...@@ -12,7 +12,7 @@ update element_table set alias_type_db ='Right square Compartment' where alias_t
update element_table set alias_type_db ='Square Compartment' where alias_type_db = 'Square Compartment Alias'; update element_table set alias_type_db ='Square Compartment' where alias_type_db = 'Square Compartment Alias';
update element_table set alias_type_db ='Top square Compartment' where alias_type_db = 'Top square Compartment Alias'; update element_table set alias_type_db ='Top square Compartment' where alias_type_db = 'Top square Compartment Alias';
alter table node_table drop column element_iddb; alter table node_table drop column if exists element_iddb;
alter table node_table rename alias_iddb to element_iddb; alter table node_table rename alias_iddb to element_iddb;
update element_table set alias_type_db ='Complex' where alias_type_db = 'Complex Species Alias'; update element_table set alias_type_db ='Complex' where alias_type_db = 'Complex Species Alias';
......
-- some sequences had too low values -- some sequences had too low values
DO $$ DO '
DECLARE DECLARE
rec RECORD; rec RECORD;
size INT; size INT;
BEGIN BEGIN
FOR rec IN SELECT * FROM information_schema.sequences LOOP FOR rec IN SELECT * FROM information_schema.sequences LOOP
/*RAISE NOTICE 'SELECT MAX(iddb)+1 FROM %', REPLACE(rec.sequence_name, '_iddb_seq', '');*/ EXECUTE format(''SELECT COUNT(1) FROM information_schema.tables WHERE table_name = ''''%s'''''', REPLACE(rec.sequence_name, ''_iddb_seq'', '''')) INTO size;
EXECUTE format('SELECT COUNT(1) FROM information_schema.tables WHERE table_name = ''%s''', REPLACE(rec.sequence_name, '_iddb_seq', '')) INTO size;
IF size = 1 THEN IF size = 1 THEN
EXECUTE format('SELECT setval(''%s'', (SELECT MAX(iddb)+1 FROM %I))', rec.sequence_name, REPLACE(rec.sequence_name, '_iddb_seq', '')); EXECUTE format(''SELECT setval(''''%s'''', (SELECT MAX(iddb)+1 FROM %I))'', rec.sequence_name, REPLACE(rec.sequence_name, ''_iddb_seq'', ''''));
END IF; END IF;
EXECUTE format('SELECT COUNT(1) FROM information_schema.tables WHERE table_name = ''%s''', REPLACE(rec.sequence_name, '_iddb_seq', '_table')) INTO size; EXECUTE format(''SELECT COUNT(1) FROM information_schema.tables WHERE table_name = ''''%s'''''', REPLACE(rec.sequence_name, ''_iddb_seq'', ''_table'')) INTO size;
IF size = 1 THEN IF size = 1 THEN
EXECUTE format('SELECT setval(''%s'', (SELECT MAX(iddb)+1 FROM %I))', rec.sequence_name, REPLACE(rec.sequence_name, '_iddb_seq', '_table')); EXECUTE format(''SELECT setval(''''%s'''', (SELECT MAX(iddb)+1 FROM %I))'', rec.sequence_name, REPLACE(rec.sequence_name, ''_iddb_seq'', ''_table''));
END IF; END IF;
END LOOP; END LOOP;
END $$; END ';
\ No newline at end of file \ No newline at end of file
...@@ -51,7 +51,7 @@ delete from cacheentry; ...@@ -51,7 +51,7 @@ delete from cacheentry;
ALTER TABLE cacheentry ALTER COLUMN iddb SET DEFAULT nextval('cacheentry_iddb_seq'::regclass); ALTER TABLE cacheentry ALTER COLUMN iddb SET DEFAULT nextval('cacheentry_iddb_seq'::regclass);
--recreate search index --recreate search index
drop index query_index; drop index if exists query_index;
CREATE INDEX query_index CREATE INDEX query_index
ON cachequery ON cachequery
USING btree USING btree
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
update cache_type set iddb = 0 where classname='lcsb.mapviewer.reactome.utils.ReactomeConnector'; 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 = 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 = 2 where classname='lcsb.mapviewer.annotation.services.ChEMBLParser';
update cache_type set iddb = 3 where classname='lcsb.mapviewer.annotation.services.PubmedBackend'; 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 = 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 = 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 = 6 where classname='lcsb.mapviewer.annotation.cache.MockCacheInterface';
......
This diff is collapsed.
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