From a19a8c05df2127ad03a75954f64caa095f8c761b Mon Sep 17 00:00:00 2001 From: Adam Rauch Date: Fri, 2 Jan 2026 17:39:17 -0800 Subject: [PATCH] Consolidate SQL scripts to *-0.000-25.000.sql --- ...0.000-21.000.sql => prot-0.000-25.000.sql} | 19 +++++++++---- .../postgresql/prot-23.000-23.001.sql | 27 ------------------- .../postgresql/prot-24.001-24.002.sql | 2 -- ...0.000-21.000.sql => prot-0.000-25.000.sql} | 4 --- .../sqlserver/prot-24.001-24.002.sql | 3 --- 5 files changed, 14 insertions(+), 41 deletions(-) rename protein/resources/schemas/dbscripts/postgresql/{prot-0.000-21.000.sql => prot-0.000-25.000.sql} (97%) delete mode 100644 protein/resources/schemas/dbscripts/postgresql/prot-23.000-23.001.sql delete mode 100644 protein/resources/schemas/dbscripts/postgresql/prot-24.001-24.002.sql rename protein/resources/schemas/dbscripts/sqlserver/{prot-0.000-21.000.sql => prot-0.000-25.000.sql} (98%) delete mode 100644 protein/resources/schemas/dbscripts/sqlserver/prot-24.001-24.002.sql diff --git a/protein/resources/schemas/dbscripts/postgresql/prot-0.000-21.000.sql b/protein/resources/schemas/dbscripts/postgresql/prot-0.000-25.000.sql similarity index 97% rename from protein/resources/schemas/dbscripts/postgresql/prot-0.000-21.000.sql rename to protein/resources/schemas/dbscripts/postgresql/prot-0.000-25.000.sql index a192d30d6b..3ef0b0cff7 100644 --- a/protein/resources/schemas/dbscripts/postgresql/prot-0.000-21.000.sql +++ b/protein/resources/schemas/dbscripts/postgresql/prot-0.000-25.000.sql @@ -14,11 +14,6 @@ * limitations under the License. */ --- @SkipScriptIfSchemaExists This script moved from the MS2 module to the Protein module in 2024. If the schema exists, --- we want this script to be recorded as "run", but don't want any of the statements executed. --- Note: This script was not consolidated in Jan, 2025 because we want prot-23.000-23.001.sql to execute on existing servers. --- TODO: Remove the above annotation in Jan, 2026 during script consolidation - CREATE SCHEMA prot; /****** AnnotInsertions */ @@ -625,3 +620,17 @@ CREATE TABLE prot.CustomAnnotation ); CREATE INDEX IX_CustomAnnotation_CustomAnnotationSetId ON prot.CustomAnnotation(CustomAnnotationSetId); + +/* 23.xxx SQL scripts */ + +-- These PostgreSQL-only special indexes use 'varchar_pattern_ops' operator, which are used when queries have pattern expressions +-- using LIKE, however, they only work when using prefixes. +-- PostgreSQL doc :https://www.postgresql.org/docs/current/indexes-opclass.html + +CREATE INDEX IF NOT EXISTS IX_ProtSequences_Identifier_VarcharPatternOps ON prot.Identifiers (lower(Identifier) varchar_pattern_ops); + +CREATE INDEX IF NOT EXISTS IX_ProtAnnotations_AnnotVal_VarcharPatternOps ON prot.Annotations (lower(AnnotVal) varchar_pattern_ops); + +CREATE INDEX IF NOT EXISTS IX_ProtFastaSequences_LookupString_VarcharPatternOps ON prot.FastaSequences (lower(LookupString) varchar_pattern_ops); + +CREATE INDEX IF NOT EXISTS IX_ProtIdentifiers_BestName_VarcharPatternOps ON prot.Sequences (lower(BestName) varchar_pattern_ops); diff --git a/protein/resources/schemas/dbscripts/postgresql/prot-23.000-23.001.sql b/protein/resources/schemas/dbscripts/postgresql/prot-23.000-23.001.sql deleted file mode 100644 index 37608d8e0f..0000000000 --- a/protein/resources/schemas/dbscripts/postgresql/prot-23.000-23.001.sql +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2022-2023 LabKey Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - --- These PostgreSQL-only special indexes use 'varchar_pattern_ops' operator, which are used when queries have pattern expressions --- using LIKE, however, they only work when using prefixes. --- PostgreSQL doc :https://www.postgresql.org/docs/current/indexes-opclass.html - -CREATE INDEX IF NOT EXISTS IX_ProtSequences_Identifier_VarcharPatternOps ON prot.Identifiers (lower(Identifier) varchar_pattern_ops); - -CREATE INDEX IF NOT EXISTS IX_ProtAnnotations_AnnotVal_VarcharPatternOps ON prot.Annotations (lower(AnnotVal) varchar_pattern_ops); - -CREATE INDEX IF NOT EXISTS IX_ProtFastaSequences_LookupString_VarcharPatternOps ON prot.FastaSequences (lower(LookupString) varchar_pattern_ops); - -CREATE INDEX IF NOT EXISTS IX_ProtIdentifiers_BestName_VarcharPatternOps ON prot.Sequences (lower(BestName) varchar_pattern_ops); \ No newline at end of file diff --git a/protein/resources/schemas/dbscripts/postgresql/prot-24.001-24.002.sql b/protein/resources/schemas/dbscripts/postgresql/prot-24.001-24.002.sql deleted file mode 100644 index 9e7f224b9f..0000000000 --- a/protein/resources/schemas/dbscripts/postgresql/prot-24.001-24.002.sql +++ /dev/null @@ -1,2 +0,0 @@ --- This view was moved to the ms2 schema. Need a one-time drop. -DROP VIEW IF EXISTS prot.FastaAdmin; diff --git a/protein/resources/schemas/dbscripts/sqlserver/prot-0.000-21.000.sql b/protein/resources/schemas/dbscripts/sqlserver/prot-0.000-25.000.sql similarity index 98% rename from protein/resources/schemas/dbscripts/sqlserver/prot-0.000-21.000.sql rename to protein/resources/schemas/dbscripts/sqlserver/prot-0.000-25.000.sql index 1fa76b477d..908b289a00 100644 --- a/protein/resources/schemas/dbscripts/sqlserver/prot-0.000-21.000.sql +++ b/protein/resources/schemas/dbscripts/sqlserver/prot-0.000-25.000.sql @@ -14,10 +14,6 @@ * limitations under the License. */ --- @SkipScriptIfSchemaExists This script moved from the MS2 module to the Protein module in 2024. If the schema exists, --- we want this script to be recorded as "run", but don't want any of the statements executed. --- TODO: Remove the above annotation in Jan, 2026 during script consolidation - CREATE SCHEMA prot; GO diff --git a/protein/resources/schemas/dbscripts/sqlserver/prot-24.001-24.002.sql b/protein/resources/schemas/dbscripts/sqlserver/prot-24.001-24.002.sql deleted file mode 100644 index 7e15cc5f74..0000000000 --- a/protein/resources/schemas/dbscripts/sqlserver/prot-24.001-24.002.sql +++ /dev/null @@ -1,3 +0,0 @@ --- This view was moved to the ms2 schema. Need a one-time drop. -EXEC core.fn_dropifexists 'FastaAdmin', 'prot', 'VIEW', NULL -GO