diff --git a/resources/schemas/dbscripts/postgresql/targetedms-0.000-24.000.sql b/resources/schemas/dbscripts/postgresql/targetedms-0.000-24.000.sql index 34779ed27..f609297bd 100644 --- a/resources/schemas/dbscripts/postgresql/targetedms-0.000-24.000.sql +++ b/resources/schemas/dbscripts/postgresql/targetedms-0.000-24.000.sql @@ -1455,7 +1455,7 @@ CREATE TABLE targetedms.QCMetricConfiguration CONSTRAINT UQ_QCMetricConfig_Name_Container UNIQUE (Name, Container) ); - +-- @SkipOnEmptySchemasBegin WITH rootIdentity as (select EntityId as theIdentity FROM core.Containers WHERE Parent is null) INSERT INTO targetedms.QCMetricConfiguration (Container, Name,Series1Label,Series1SchemaName,Series1QueryName,Series2Label,Series2SchemaName,Series2QueryName) VALUES ((select theIdentity from rootIdentity), 'Retention Time','Retention Time','targetedms','QCMetric_retentionTime',NULL , NULL , NULL ), @@ -1466,6 +1466,7 @@ INSERT INTO targetedms.QCMetricConfiguration (Container, Name,Series1Label,Serie ((select theIdentity from rootIdentity), 'Transition/Precursor Area Ratio','Transition/Precursor Area Ratio','targetedms','QCMetric_transitionPrecursorRatio',NULL , NULL , NULL ), ((select theIdentity from rootIdentity), 'Transition/Precursor Areas','Transition Area','targetedms','QCMetric_transitionArea','Precursor Area','targetedms','QCMetric_precursorArea'), ((select theIdentity from rootIdentity), 'Mass Accuracy','Mass Accuracy','targetedms','QCMetric_massAccuracy',NULL , NULL , NULL ); +-- @SkipOnEmptySchemasEnd -- Add column to ReplicateAnnotation to store the source of the annotation (e.g. Skyline or AutoQC) ALTER TABLE targetedms.ReplicateAnnotation ADD COLUMN Source VARCHAR(20) NOT NULL DEFAULT 'Skyline'; @@ -1800,9 +1801,11 @@ ALTER TABLE targetedms.MeasuredDriftTime ADD IonMobilityUnits VARCHAR(30); ALTER TABLE targetedms.Runs ADD COLUMN AuditLogEntriesCount INT4 DEFAULT 0 NOT NULL; +-- @SkipOnEmptySchemasBegin WITH rootIdentity as (select EntityId as theIdentity FROM core.Containers WHERE Parent is null) INSERT INTO targetedms.QCMetricConfiguration (Container, Name,Series1Label,Series1SchemaName,Series1QueryName,Series2Label,Series2SchemaName,Series2QueryName,PrecursorScoped) VALUES ((select theIdentity from rootIdentity), 'TIC Area','TIC Area','targetedms','QCRunMetric_ticArea',NULL , NULL , NULL , FALSE ); +-- @SkipOnEmptySchemasEnd ALTER TABLE targetedms.SampleFile ADD COLUMN TicArea DOUBLE PRECISION; @@ -1860,6 +1863,7 @@ CREATE TABLE targetedms.ListItemValue ALTER TABLE targetedms.QCMetricConfiguration ADD COLUMN EnabledQueryName VARCHAR(200); ALTER TABLE targetedms.QCMetricConfiguration ADD COLUMN EnabledSchemaName VARCHAR(200); +-- @SkipOnEmptySchemasBegin WITH rootIdentity as (select EntityId as theIdentity FROM core.Containers WHERE Parent is null) INSERT INTO targetedms.QCMetricConfiguration (Container, Name,Series1Label,Series1SchemaName,Series1QueryName,Series2Label,Series2SchemaName,Series2QueryName,PrecursorScoped, EnabledQueryName, EnabledSchemaName) VALUES ((select theIdentity from rootIdentity), 'Isotopologue LOD', 'LOD','targetedms', 'QCMetric_IsotopologuePrecursorLOD', NULL, NULL, NULL, TRUE, 'QCMetricEnabled_IsotopologuePrecursorLOD', 'targetedms'); @@ -1877,6 +1881,7 @@ INSERT INTO targetedms.QCMetricConfiguration (Container, Name,Series1Label,Serie ((select theIdentity from rootIdentity), 'Isotopologue Regression RSquared', 'Coefficient', 'targetedms', 'QCMetric_IsotopologuePrecursorRSquared', NULL, NULL, NULL, TRUE, 'QCMetricEnabled_IsotopologuePrecursorRSquared', 'targetedms'); UPDATE targetedms.QCMetricConfiguration SET EnabledQueryName = 'QCMetricEnabled_lhRatio', EnabledSchemaName ='targetedms' WHERE Series1QueryName = 'QCMetric_lhRatio'; +-- @SkipOnEmptySchemasEnd ALTER TABLE targetedms.runs ALTER COLUMN SoftwareVersion TYPE VARCHAR(200); @@ -2229,6 +2234,7 @@ CREATE TABLE targetedms.keywords ( CONSTRAINT keywords_keywordid_key UNIQUE (keywordid) ); +-- @SkipOnEmptySchemasBegin INSERT INTO targetedms.keywordcategories VALUES (1, 'KW-9999', 'Biological process'); INSERT INTO targetedms.keywordcategories VALUES (2, 'KW-9998', 'Cellular component'); INSERT INTO targetedms.keywordcategories VALUES (3, 'KW-9997', 'Coding sequence diversity'); @@ -3423,6 +3429,7 @@ INSERT INTO targetedms.keywords VALUES ( DEFAULT, 'KW-1268', 'Autism spectrum di INSERT INTO targetedms.keywords VALUES ( DEFAULT, 'KW-1269', 'Autism', 'KW-9995'); INSERT INTO targetedms.keywords VALUES ( DEFAULT, 'KW-1270', 'Asperger syndrome', 'KW-9995'); INSERT INTO targetedms.keywords VALUES ( DEFAULT, 'KW-1271', 'Inflammasome', 'KW-9998'); +-- @SkipOnEmptySchemasEnd ALTER TABLE targetedms.Runs ALTER COLUMN Id TYPE bigint; @@ -3924,6 +3931,7 @@ ALTER TABLE targetedms.SampleFile ADD IRTSlope REAL; ALTER TABLE targetedms.SampleFile ADD IRTIntercept REAL; ALTER TABLE targetedms.SampleFile ADD IRTCorrelation REAL; +-- @SkipOnEmptySchemasBegin WITH rootIdentity as (select EntityId as theIdentity FROM core.Containers WHERE Parent is null) INSERT INTO targetedms.QCMetricConfiguration (Container, Name, Series1Label, Series1SchemaName, Series1QueryName, PrecursorScoped, EnabledQueryName, EnabledSchemaName) VALUES ((select theIdentity from rootIdentity), 'iRT Slope', 'iRT Slope', 'targetedms', 'QCRunMetric_iRTSlope', false, 'QCRunMetricEnabled_iRTSlope', 'targetedms'); @@ -3943,7 +3951,6 @@ WITH rootIdentity as (select EntityId as theIdentity FROM core.Containers WHERE INSERT INTO targetedms.QCMetricConfiguration (Container, Name, Series1Label, Series1SchemaName, Series1QueryName, PrecursorScoped) VALUES ((select theIdentity from rootIdentity), 'Precursor Area', 'Precursor Area', 'targetedms', 'QCMetric_precursorArea', true); - WITH rootIdentity as (select EntityId as theIdentity FROM core.Containers WHERE Parent is null) INSERT INTO targetedms.QCMetricConfiguration (Container, Name, Series1Label, Series1SchemaName, Series1QueryName, PrecursorScoped, EnabledQueryName, EnabledSchemaName) VALUES ((select theIdentity from rootIdentity), 'Transition Area', 'Transition Area', 'targetedms', 'QCMetric_transitionArea', true, 'QCMetricEnabled_transitionArea', 'targetedms'); @@ -3970,6 +3977,7 @@ SET EnabledQueryName = 'QCMetricEnabled_transitionArea', EnabledSchemaName = 'targetedms' WHERE Name = 'Transition & Precursor Areas'; +-- @SkipOnEmptySchemasEnd ALTER TABLE targetedms.PrecursorChromInfo ADD COLUMN TotalAreaMs1 REAL, @@ -4025,6 +4033,7 @@ SELECT core.fn_dropifexists('AuditLogEntry', 'targetedms', 'CONSTRAINT', 'fk_aud ALTER TABLE targetedms.AuditLogEntry DROP COLUMN VersionId; +-- @SkipOnEmptySchemasBegin WITH rootIdentity as (select EntityId as theIdentity FROM core.Containers WHERE Parent is null) INSERT INTO targetedms.QCMetricConfiguration (Container, Name, Series1Label, Series1SchemaName, Series1QueryName, PrecursorScoped, EnabledQueryName, EnabledSchemaName) VALUES ((select theIdentity from rootIdentity), 'Library dotp', 'Library dotp', 'targetedms', 'QCMetric_libraryDotp', true, 'QCMetricEnabled_libraryDotp', 'targetedms'); @@ -4032,6 +4041,7 @@ INSERT INTO targetedms.QCMetricConfiguration (Container, Name, Series1Label, Ser WITH rootIdentity as (select EntityId as theIdentity FROM core.Containers WHERE Parent is null) INSERT INTO targetedms.QCMetricConfiguration (Container, Name, Series1Label, Series1SchemaName, Series1QueryName, PrecursorScoped, EnabledQueryName, EnabledSchemaName) VALUES ((select theIdentity from rootIdentity), 'Isotope dotp', 'Isotope dotp', 'targetedms', 'QCMetric_isotopeDotp', true, 'QCMetricEnabled_isotopeDotp', 'targetedms'); +-- @SkipOnEmptySchemasEnd -- Reparent table if it exists in PanoramaPremium schema ALTER TABLE IF EXISTS PanoramaPremium.QCEmailNotifications SET SCHEMA targetedms; diff --git a/resources/schemas/dbscripts/postgresql/targetedms-24.000-24.001.sql b/resources/schemas/dbscripts/postgresql/targetedms-24.000-24.001.sql index f8c6a7cbc..137f7d669 100644 --- a/resources/schemas/dbscripts/postgresql/targetedms-24.000-24.001.sql +++ b/resources/schemas/dbscripts/postgresql/targetedms-24.000-24.001.sql @@ -6,7 +6,8 @@ UPDATE targetedms.QCMetricConfiguration SET YAxisLabel1 = 'Mass Error PPM' WHERE Name = 'Mass Accuracy'; +-- @SkipOnEmptySchemasBegin WITH rootIdentity AS (SELECT EntityId AS theIdentity FROM core.Containers WHERE Parent IS NULL) INSERT INTO targetedms.QCMetricConfiguration (Container, Name, Series1Label, Series1SchemaName, Series1QueryName, EnabledSchemaName, EnabledQueryName, YAxisLabel1) VALUES - ((SELECT theIdentity FROM rootIdentity), 'Transition Mass Error','Transition Mass Error','targetedms','QCMetric_massErrorTransition', 'targetedms', 'QCMetricEnabled_massErrorTransition', 'Mass Error PPM') -; + ((SELECT theIdentity FROM rootIdentity), 'Transition Mass Error','Transition Mass Error','targetedms','QCMetric_massErrorTransition', 'targetedms', 'QCMetricEnabled_massErrorTransition', 'Mass Error PPM'); +-- @SkipOnEmptySchemasEnd diff --git a/src/org/labkey/targetedms/TargetedMSUpgradeCode.java b/src/org/labkey/targetedms/TargetedMSUpgradeCode.java index 04e236169..8a1df7d1f 100644 --- a/src/org/labkey/targetedms/TargetedMSUpgradeCode.java +++ b/src/org/labkey/targetedms/TargetedMSUpgradeCode.java @@ -54,21 +54,27 @@ public class TargetedMSUpgradeCode implements UpgradeCode @SuppressWarnings({"UnusedDeclaration"}) public void populateDefaultAnnotationTypes(final ModuleContext moduleContext) { - insertAnnotationType("Instrumentation Change", "FF0000", moduleContext.getUpgradeUser()); - insertAnnotationType("Reagent Change", "00FF00", moduleContext.getUpgradeUser()); - insertAnnotationType("Technician Change", "0000FF", moduleContext.getUpgradeUser()); + if (ModuleLoader.getInstance().shouldInsertData()) + { + insertAnnotationType("Instrumentation Change", "FF0000", moduleContext.getUpgradeUser()); + insertAnnotationType("Reagent Change", "00FF00", moduleContext.getUpgradeUser()); + insertAnnotationType("Technician Change", "0000FF", moduleContext.getUpgradeUser()); - // Enable the module in the /Shared container so that it can be resolved - Set activeModules = new HashSet<>(ContainerManager.getSharedContainer().getActiveModules()); - activeModules.add(ModuleLoader.getInstance().getModule(TargetedMSModule.class)); - ContainerManager.getSharedContainer().setActiveModules(activeModules); + // Enable the module in the /Shared container so that it can be resolved + Set activeModules = new HashSet<>(ContainerManager.getSharedContainer().getActiveModules()); + activeModules.add(ModuleLoader.getInstance().getModule(TargetedMSModule.class)); + ContainerManager.getSharedContainer().setActiveModules(activeModules); + } } // initialization code called at 0.000-24.000 to add a new type. Can eventually be consolidated into the bootstrap insert above @SuppressWarnings({"UnusedDeclaration"}) public void addInstrumentDowntimeAnnotationType(final ModuleContext moduleContext) { - insertAnnotationType(QCAnnotationTypeTable.INSTRUMENT_DOWNTIME, "CCCC00", moduleContext.getUpgradeUser()); + if (ModuleLoader.getInstance().shouldInsertData()) + { + insertAnnotationType(QCAnnotationTypeTable.INSTRUMENT_DOWNTIME, "CCCC00", moduleContext.getUpgradeUser()); + } } private void insertAnnotationType(String name, String color, User user)