diff --git a/flow/src/org/labkey/flow/controllers/FlowController.java b/flow/src/org/labkey/flow/controllers/FlowController.java index 62b5baec3..4dc09b289 100644 --- a/flow/src/org/labkey/flow/controllers/FlowController.java +++ b/flow/src/org/labkey/flow/controllers/FlowController.java @@ -46,6 +46,7 @@ import org.labkey.api.util.FileUtil; import org.labkey.api.util.JobRunner; import org.labkey.api.util.TestContext; +import org.labkey.api.util.URLHelper; import org.labkey.api.view.ActionURL; import org.labkey.api.view.HttpView; import org.labkey.api.view.JspView; @@ -72,8 +73,6 @@ import org.springframework.validation.Errors; import org.springframework.web.servlet.ModelAndView; -import java.net.URI; - @Marshal(Marshaller.Jackson) public class FlowController extends BaseFlowController { @@ -367,8 +366,8 @@ public class SavePreferencesAction extends SimpleViewAction public ModelAndView getView(Object o, BindException errors) throws Exception { FlowPreference.update(getRequest()); - URI uri = new URI(getRequest().getContextPath() + "/_.gif"); - return HttpView.redirect(uri.toString()); + URLHelper url = new URLHelper(getRequest().getContextPath() + "/_.gif"); + return HttpView.redirect(url, false); } @Override diff --git a/protein/resources/schemas/dbscripts/postgresql/prot-0.000-21.000.sql b/protein/resources/schemas/dbscripts/postgresql/prot-0.000-21.000.sql index fb01593c0..a192d30d6 100644 --- a/protein/resources/schemas/dbscripts/postgresql/prot-0.000-21.000.sql +++ b/protein/resources/schemas/dbscripts/postgresql/prot-0.000-21.000.sql @@ -70,6 +70,7 @@ CREATE TABLE prot.InfoSources /*** Initializations */ +-- @SkipOnEmptySchemasBegin INSERT INTO prot.InfoSources (Name, Url, InsertDate) VALUES ('Genbank', 'http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=protein&cmd=search&term={}', '2005-03-04 12:08:10'); INSERT INTO prot.InfoSources (Name, Url, InsertDate) VALUES ('NiceProt', 'http://au.expasy.org/cgi-bin/niceprot.pl?{}', '2005-03-04 12:08:10'); INSERT INTO prot.InfoSources (Name, Url, InsertDate) VALUES ('GeneCards', 'http://www.genecards.org/cgi-bin/carddisp?{}&alias=yes', '2005-03-04 12:08:10'); @@ -80,6 +81,7 @@ UPDATE prot.InfoSources SET Url = 'http://www.genecards.org/cgi-bin/carddisp.pl? UPDATE prot.InfoSources SET URL = 'http://www.uniprot.org/uniprot/{}' WHERE Name = 'NiceProt'; UPDATE prot.InfoSources SET URL = 'http://www.ncbi.nlm.nih.gov/protein/{}' WHERE Name = 'Genbank'; UPDATE prot.infosources SET url = 'http://amigo.geneontology.org/amigo/term/{}' WHERE Name = 'GO'; +-- @SkipOnEmptySchemasEnd /****** AnnotationTypes */ CREATE TABLE prot.AnnotationTypes @@ -97,6 +99,7 @@ CREATE TABLE prot.AnnotationTypes ); CREATE UNIQUE INDEX UQ_ProtAnnotationTypes ON prot.AnnotationTypes(Name); +-- @SkipOnEmptySchemasBegin INSERT INTO prot.AnnotationTypes (Name,SourceId,EntryDate) VALUES ('GO_F',5,'2005-03-04 11:37:15'); INSERT INTO prot.AnnotationTypes (Name,SourceId,EntryDate) VALUES ('GO_P',5,'2005-03-04 11:37:15'); INSERT INTO prot.AnnotationTypes (Name,EntryDate) VALUES ('keyword','2005-03-04 11:37:15'); @@ -104,6 +107,7 @@ INSERT INTO prot.AnnotationTypes (Name,EntryDate) VALUES ('feature','2005-03-04 INSERT INTO prot.AnnotationTypes (Name,SourceId,EntryDate) VALUES ('GO_C',5,'2005-03-04 11:38:13'); INSERT INTO prot.AnnotationTypes (Name,EntryDate) VALUES ('FullOrganismName',now()); INSERT INTO prot.AnnotationTypes (Name,EntryDate) VALUES ('LookupString',now()); +-- @SkipOnEmptySchemasEnd CREATE INDEX IX_AnnotationTypes_SourceId ON prot.annotationtypes(SourceId); @@ -124,6 +128,7 @@ CREATE TABLE prot.IdentTypes CREATE UNIQUE INDEX UQ_ProtIdentTypes ON prot.IdentTypes(Name); CREATE INDEX IX_IdentTypes_cannonicalsourceid ON prot.IdentTypes(cannonicalsourceid); +-- @SkipOnEmptySchemasBegin INSERT INTO prot.IdentTypes (Name,CannonicalSourceId,EntryDate) VALUES ('Genbank',1,'2005-03-04 11:37:14'); INSERT INTO prot.IdentTypes (Name,CannonicalSourceId,EntryDate) VALUES ('SwissProt',2,'2005-03-04 11:37:14'); INSERT INTO prot.IdentTypes (Name,CannonicalSourceId,EntryDate) VALUES ('GeneName',3,'2005-03-04 11:37:14'); @@ -193,6 +198,7 @@ INSERT INTO prot.IdentTypes (Name,EntryDate) VALUES ('PhosSite','2005-03-04 12:4 INSERT INTO prot.IdentTypes (Name,EntryDate) VALUES ('REBASE','2005-03-04 13:25:29'); INSERT INTO prot.IdentTypes (Name,EntryDate) VALUES ('Maize-2DPAGE','2005-03-04 15:10:53'); INSERT INTO prot.IdentTypes (Name,EntryDate) VALUES ('HIV','2005-03-04 22:13:40'); +-- @SkipOnEmptySchemasEnd /****** Organisms */ CREATE TABLE prot.Organisms @@ -209,7 +215,9 @@ CREATE TABLE prot.Organisms ); CREATE UNIQUE INDEX UQ_ProtOrganisms_Genus_Species ON prot.Organisms(Genus, Species); +-- @SkipOnEmptySchemasBegin INSERT INTO prot.Organisms (CommonName,Genus,Species,Comments) VALUES ('Unknown organism','Unknown','unknown','Organism is unknown'); +-- @SkipOnEmptySchemasEnd CREATE INDEX IX_Organisms_IdentId ON prot.Organisms(IdentId); @@ -497,6 +505,7 @@ CREATE FUNCTION prot.drop_go_indexes() RETURNS void AS $$ END; $$ LANGUAGE plpgsql; +-- @SkipOnEmptySchemasBegin -- add most common ncbi Taxonomy id's CREATE TEMPORARY TABLE idents @@ -568,6 +577,7 @@ UPDATE prot.Organisms WHERE i.OrgId = Organisms.OrgId; DROP TABLE idents; +-- @SkipOnEmptySchemasEnd CREATE TABLE prot.FastaSequences ( diff --git a/protein/resources/schemas/dbscripts/postgresql/prot-25.000-25.001.sql b/protein/resources/schemas/dbscripts/postgresql/prot-25.000-25.001.sql new file mode 100644 index 000000000..2c81d8562 --- /dev/null +++ b/protein/resources/schemas/dbscripts/postgresql/prot-25.000-25.001.sql @@ -0,0 +1,8 @@ +-- These columns are unused and, due to data type differences, are problematic for SQL Server -> PostgreSQL migration +ALTER TABLE prot.InfoSources DROP COLUMN Deleted; +ALTER TABLE prot.AnnotationTypes DROP COLUMN Deleted; +ALTER TABLE prot.IdentTypes DROP COLUMN Deleted; +ALTER TABLE prot.Organisms DROP COLUMN Deleted; +ALTER TABLE prot.Sequences DROP COLUMN Deleted; +ALTER TABLE prot.Identifiers DROP COLUMN Deleted; +ALTER TABLE prot.Annotations DROP COLUMN Deleted; diff --git a/protein/resources/schemas/dbscripts/sqlserver/prot-25.000-25.001.sql b/protein/resources/schemas/dbscripts/sqlserver/prot-25.000-25.001.sql new file mode 100644 index 000000000..a88892cbc --- /dev/null +++ b/protein/resources/schemas/dbscripts/sqlserver/prot-25.000-25.001.sql @@ -0,0 +1,8 @@ +-- These columns are unused and, due to data type differences, are problematic for SQL Server -> PostgreSQL migration +EXEC core.fn_dropifexists 'InfoSources', 'prot', 'COLUMN', 'Deleted'; +EXEC core.fn_dropifexists 'AnnotationTypes', 'prot', 'COLUMN', 'Deleted'; +EXEC core.fn_dropifexists 'IdentTypes', 'prot', 'COLUMN', 'Deleted'; +EXEC core.fn_dropifexists 'Organisms', 'prot', 'COLUMN', 'Deleted'; +EXEC core.fn_dropifexists 'Sequences', 'prot', 'COLUMN', 'Deleted'; +EXEC core.fn_dropifexists 'Identifiers', 'prot', 'COLUMN', 'Deleted'; +EXEC core.fn_dropifexists 'Annotations', 'prot', 'COLUMN', 'Deleted'; diff --git a/protein/resources/schemas/dbscripts/sqlserver/prot-25.001-25.002.sql b/protein/resources/schemas/dbscripts/sqlserver/prot-25.001-25.002.sql new file mode 100644 index 000000000..13807b79f --- /dev/null +++ b/protein/resources/schemas/dbscripts/sqlserver/prot-25.001-25.002.sql @@ -0,0 +1,3 @@ +-- Move foreign key to the correct table. Issue 53523. +ALTER TABLE prot.Organisms DROP CONSTRAINT FK_ProtSequences_ProtOrganisms; +ALTER TABLE prot.Sequences ADD CONSTRAINT FK_ProtSequences_ProtOrganisms FOREIGN KEY (OrgId) REFERENCES prot.Organisms (OrgId); diff --git a/protein/resources/schemas/prot.xml b/protein/resources/schemas/prot.xml index 3034492ea..7b8a17834 100644 --- a/protein/resources/schemas/prot.xml +++ b/protein/resources/schemas/prot.xml @@ -38,9 +38,6 @@ - - true - @@ -53,7 +50,6 @@ -
@@ -135,9 +131,6 @@ true - - true -
@@ -151,9 +144,6 @@ - - true -
@@ -169,7 +159,6 @@ -
@@ -185,9 +174,6 @@ true - - true -
@@ -229,9 +215,6 @@ - - true - Contains a row per protein known to this server installation.
diff --git a/protein/src/org/labkey/protein/ProteinModule.java b/protein/src/org/labkey/protein/ProteinModule.java index 1ebf33e9b..7670f5f1d 100644 --- a/protein/src/org/labkey/protein/ProteinModule.java +++ b/protein/src/org/labkey/protein/ProteinModule.java @@ -20,9 +20,13 @@ import org.jetbrains.annotations.Nullable; import org.labkey.api.data.Container; import org.labkey.api.data.ContainerManager; +import org.labkey.api.data.DbSchema; +import org.labkey.api.data.SqlExecutor; import org.labkey.api.data.TableSelector; import org.labkey.api.files.FileContentService; import org.labkey.api.files.TableUpdaterFileListener; +import org.labkey.api.module.DatabaseMigration; +import org.labkey.api.module.DatabaseMigration.DefaultMigrationHandler; import org.labkey.api.module.DefaultModule; import org.labkey.api.module.ModuleContext; import org.labkey.api.pipeline.PipelineService; @@ -62,7 +66,7 @@ public String getName() @Override public @Nullable Double getSchemaVersion() { - return 25.000; + return 25.001; } @Override @@ -125,6 +129,20 @@ public void doStartup(ModuleContext moduleContext) } ProteinService.get().registerProteinSearchView(new ProteinSearchViewProvider()); + DatabaseMigration.registerHandler(ProteinSchema.getSchema(), new DefaultMigrationHandler() + { + @Override + public void beforeSchema(DbSchema targetSchema) + { + new SqlExecutor(targetSchema).execute("ALTER TABLE prot.Organisms DROP CONSTRAINT FK_ProtOrganisms_ProtIdentifiers"); + } + + @Override + public void afterSchema(DbSchema targetSchema) + { + new SqlExecutor(targetSchema).execute("ALTER TABLE prot.Organisms ADD CONSTRAINT FK_ProtOrganisms_ProtIdentifiers FOREIGN KEY (IdentId) REFERENCES prot.Identifiers (IdentId)"); + } + }); } @Override