Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -275,23 +275,19 @@ ALTER TABLE flow.Graph ADD CONSTRAINT FK_Graph_GraphAttr FOREIGN KEY (GraphId) R
UPDATE flow.GraphAttr SET Id = RowId;

-- Change 'PK_*' unique constraints to actually be primary key constraint.
SELECT core.fn_dropifexists('Keyword', 'flow', 'constraint', 'PK_Keyword');
ALTER TABLE flow.Keyword ADD CONSTRAINT PK_Keyword PRIMARY KEY (ObjectId, KeywordId);
CLUSTER PK_Keyword ON flow.keyword;

SELECT core.fn_dropifexists('Statistic', 'flow', 'constraint', 'PK_Statistic');
ALTER TABLE flow.Statistic ADD CONSTRAINT PK_Statistic PRIMARY KEY (ObjectId, StatisticId);
CLUSTER PK_Statistic ON flow.statistic;

ALTER TABLE flow.Graph DROP COLUMN rowid;
SELECT core.fn_dropifexists('Graph', 'flow', 'constraint', 'PK_Graph');
SELECT core.fn_dropifexists('Graph', 'flow', 'constraint', 'UQ_Graph');
ALTER TABLE flow.Graph ADD CONSTRAINT PK_Graph PRIMARY KEY (ObjectId, GraphId);
CLUSTER PK_Graph ON flow.graph;


-- flow.Attribute table no longer used
SELECT core.fn_dropifexists('Attribute', 'flow', 'TABLE', NULL);
DROP TABLE IF EXISTS flow.Attribute;

/* flow-11.20-11.30.sql */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -469,34 +469,33 @@ CREATE FUNCTION prot.create_go_indexes() RETURNS void AS $$
END;
$$ LANGUAGE plpgsql;

-- Use fn_dropifexists to increase reliability
CREATE FUNCTION prot.drop_go_indexes() RETURNS void AS $$
BEGIN
PERFORM core.fn_dropifexists('goterm', 'prot', 'Constraint', 'pk_goterm');
PERFORM core.fn_dropifexists('goterm', 'prot', 'Index', 'IX_GoTerm_Name');
PERFORM core.fn_dropifexists('goterm', 'prot', 'Index', 'IX_GoTerm_TermType');
PERFORM core.fn_dropifexists('goterm', 'prot', 'Index', 'UQ_GoTerm_Acc');

PERFORM core.fn_dropifexists('goterm2term', 'prot', 'Constraint', 'pk_goterm2term');
PERFORM core.fn_dropifexists('goterm2term', 'prot', 'Index', 'IX_GoTerm2Term_term1Id');
PERFORM core.fn_dropifexists('goterm2term', 'prot', 'Index', 'IX_GoTerm2Term_term2Id');
PERFORM core.fn_dropifexists('goterm2term', 'prot', 'Index', 'IX_GoTerm2Term_term1_2_Id');
PERFORM core.fn_dropifexists('goterm2term', 'prot', 'Index', 'IX_GoTerm2Term_relationshipTypeId');
PERFORM core.fn_dropifexists('goterm2term', 'prot', 'Index', 'UQ_GoTerm2Term_1_2_R');

PERFORM core.fn_dropifexists('gographpath', 'prot', 'Constraint', 'pk_gographpath');
PERFORM core.fn_dropifexists('gographpath', 'prot', 'Index', 'IX_GoGraphPath_term1Id');
PERFORM core.fn_dropifexists('gographpath', 'prot', 'Index', 'IX_GoGraphPath_term2Id');
PERFORM core.fn_dropifexists('gographpath', 'prot', 'Index', 'IX_GoGraphPath_term1_2_Id');
PERFORM core.fn_dropifexists('gographpath', 'prot', 'Index', 'IX_GoGraphPath_t1_distance');

PERFORM core.fn_dropifexists('gotermdefinition', 'prot', 'Index', 'IX_GoTermDefinition_dbXrefId');
PERFORM core.fn_dropifexists('gotermdefinition', 'prot', 'Index', 'UQ_GoTermDefinition_termId');

PERFORM core.fn_dropifexists('gotermsynonym', 'prot', 'Index', 'IX_GoTermSynonym_SynonymTypeId');
PERFORM core.fn_dropifexists('gotermsynonym', 'prot', 'Index', 'IX_GoTermSynonym_TermId');
PERFORM core.fn_dropifexists('gotermsynonym', 'prot', 'Index', 'IX_GoTermSynonym_termSynonym');
PERFORM core.fn_dropifexists('gotermsynonym', 'prot', 'Index', 'UQ_GoTermSynonym_termId_termSynonym');
ALTER TABLE prot.goterm DROP CONSTRAINT IF EXISTS pk_goterm;
DROP INDEX IF EXISTS prot.IX_GoTerm_Name;
DROP INDEX IF EXISTS prot.IX_GoTerm_TermType;
DROP INDEX IF EXISTS prot.UQ_GoTerm_Acc;

ALTER TABLE prot.goterm2term DROP CONSTRAINT IF EXISTS pk_goterm2term;
DROP INDEX IF EXISTS prot.IX_GoTerm2Term_term1Id;
DROP INDEX IF EXISTS prot.IX_GoTerm2Term_term2Id;
DROP INDEX IF EXISTS prot.IX_GoTerm2Term_term1_2_Id;
DROP INDEX IF EXISTS prot.IX_GoTerm2Term_relationshipTypeId;
DROP INDEX IF EXISTS prot.UQ_GoTerm2Term_1_2_R;

ALTER TABLE prot.gographpath DROP CONSTRAINT IF EXISTS pk_gographpath;
DROP INDEX IF EXISTS prot.IX_GoGraphPath_term1Id;
DROP INDEX IF EXISTS prot.IX_GoGraphPath_term2Id;
DROP INDEX IF EXISTS prot.IX_GoGraphPath_term1_2_Id;
DROP INDEX IF EXISTS prot.IX_GoGraphPath_t1_distance;

DROP INDEX IF EXISTS prot.IX_GoTermDefinition_dbXrefId;
DROP INDEX IF EXISTS prot.UQ_GoTermDefinition_termId;

DROP INDEX IF EXISTS prot.IX_GoTermSynonym_SynonymTypeId;
DROP INDEX IF EXISTS prot.IX_GoTermSynonym_TermId;
DROP INDEX IF EXISTS prot.IX_GoTermSynonym_termSynonym;
DROP INDEX IF EXISTS prot.UQ_GoTermSynonym_termId_termSynonym;
END;
$$ LANGUAGE plpgsql;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,29 +43,28 @@ BEGIN
END;
$$ LANGUAGE plpgsql;

-- Use fn_dropifexists to increase reliability
CREATE OR REPLACE FUNCTION prot.drop_go_indexes() RETURNS void AS $$
BEGIN
PERFORM core.fn_dropifexists('goterm', 'prot', 'Constraint', 'pk_goterm');
PERFORM core.fn_dropifexists('goterm', 'prot', 'Index', 'IX_GoTerm_Name');
PERFORM core.fn_dropifexists('goterm', 'prot', 'Index', 'IX_GoTerm_TermType');
PERFORM core.fn_dropifexists('goterm', 'prot', 'Index', 'UQ_GoTerm_Acc');
ALTER TABLE prot.goterm DROP CONSTRAINT IF EXISTS pk_goterm;
DROP INDEX IF EXISTS prot.IX_GoTerm_Name;
DROP INDEX IF EXISTS prot.IX_GoTerm_TermType;
DROP INDEX IF EXISTS prot.UQ_GoTerm_Acc;

PERFORM core.fn_dropifexists('goterm2term', 'prot', 'Constraint', 'pk_goterm2term');
PERFORM core.fn_dropifexists('goterm2term', 'prot', 'Index', 'IX_GoTerm2Term_term2Id');
PERFORM core.fn_dropifexists('goterm2term', 'prot', 'Index', 'IX_GoTerm2Term_relationshipTypeId');
PERFORM core.fn_dropifexists('goterm2term', 'prot', 'Index', 'UQ_GoTerm2Term_1_2_R');
ALTER TABLE prot.goterm2term DROP CONSTRAINT IF EXISTS pk_goterm2term;
DROP INDEX IF EXISTS prot.IX_GoTerm2Term_term2Id;
DROP INDEX IF EXISTS prot.IX_GoTerm2Term_relationshipTypeId;
DROP INDEX IF EXISTS prot.UQ_GoTerm2Term_1_2_R;

PERFORM core.fn_dropifexists('gographpath', 'prot', 'Constraint', 'pk_gographpath');
PERFORM core.fn_dropifexists('gographpath', 'prot', 'Index', 'IX_GoGraphPath_term2Id');
PERFORM core.fn_dropifexists('gographpath', 'prot', 'Index', 'IX_GoGraphPath_term1_2_Id');
PERFORM core.fn_dropifexists('gographpath', 'prot', 'Index', 'IX_GoGraphPath_t1_distance');
ALTER TABLE prot.gographpath DROP CONSTRAINT IF EXISTS pk_gographpath;
DROP INDEX IF EXISTS prot.IX_GoGraphPath_term2Id;
DROP INDEX IF EXISTS prot.IX_GoGraphPath_term1_2_Id;
DROP INDEX IF EXISTS prot.IX_GoGraphPath_t1_distance;

PERFORM core.fn_dropifexists('gotermdefinition', 'prot', 'Index', 'IX_GoTermDefinition_dbXrefId');
PERFORM core.fn_dropifexists('gotermdefinition', 'prot', 'Index', 'UQ_GoTermDefinition_termId');
DROP INDEX IF EXISTS prot.IX_GoTermDefinition_dbXrefId;
DROP INDEX IF EXISTS prot.UQ_GoTermDefinition_termId;

PERFORM core.fn_dropifexists('gotermsynonym', 'prot', 'Index', 'IX_GoTermSynonym_SynonymTypeId');
PERFORM core.fn_dropifexists('gotermsynonym', 'prot', 'Index', 'IX_GoTermSynonym_termSynonym');
PERFORM core.fn_dropifexists('gotermsynonym', 'prot', 'Index', 'UQ_GoTermSynonym_termId_termSynonym');
DROP INDEX IF EXISTS prot.IX_GoTermSynonym_SynonymTypeId;
DROP INDEX IF EXISTS prot.IX_GoTermSynonym_termSynonym;
DROP INDEX IF EXISTS prot.UQ_GoTermSynonym_termId_termSynonym;
END;
$$ LANGUAGE plpgsql;
Loading