diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/PathInfoDatabaseVersionHolder.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/PathInfoDatabaseVersionHolder.java index 3ffc15c1bf4f4d3a2f3b6ef0300ece5e5451e6b2..4c1b858f518849cb9b9b26b8a3289a4eadafdd9a 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/PathInfoDatabaseVersionHolder.java +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/PathInfoDatabaseVersionHolder.java @@ -18,14 +18,14 @@ package ch.systemsx.cisd.openbis.dss.generic.shared; /** * Holds the actual version of the pathinfo database which stores path information of data sets. - * + * * @author Franz-Josef Elmer */ public class PathInfoDatabaseVersionHolder implements IDatabaseVersionHolder { public String getDatabaseVersion() { - return "002"; // S109 + return "003"; // S109 } } diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/content/PathInfoProviderBasedHierarchicalContent.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/content/PathInfoProviderBasedHierarchicalContent.java index 7cca3c57e8f6c195d77868c119624b6577b154bb..fa0996d542553ff8e3a7bbb1eb61311cf78eb861 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/content/PathInfoProviderBasedHierarchicalContent.java +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/content/PathInfoProviderBasedHierarchicalContent.java @@ -21,7 +21,6 @@ import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.util.ArrayList; -import java.util.Date; import java.util.List; import ch.systemsx.cisd.base.exceptions.CheckedExceptionTunnel; @@ -210,8 +209,7 @@ class PathInfoProviderBasedHierarchicalContent implements IHierarchicalContent public long getLastModified() { - Date lastModified = pathInfo.getLastModified(); - return lastModified == null ? System.currentTimeMillis() : lastModified.getTime(); + return pathInfo.getLastModified().getTime(); } @Override @@ -311,7 +309,8 @@ class PathInfoProviderBasedHierarchicalContent implements IHierarchicalContent IHierarchicalContentNode node = containerNode.getChildNode(relativePath); return asFileContentProvider(node); } - throw new IllegalArgumentException("Resource '" + FileUtilities.getRelativeFilePath(root, file) + throw new IllegalArgumentException("Resource '" + + FileUtilities.getRelativeFilePath(root, file) + "' is currently unavailable. It might be in an archive."); } diff --git a/datastore_server/source/sql/postgresql/003/schema-003.sql b/datastore_server/source/sql/postgresql/003/schema-003.sql new file mode 100644 index 0000000000000000000000000000000000000000..457c34eb1797ca0f54727df76904cd021a9abf3a --- /dev/null +++ b/datastore_server/source/sql/postgresql/003/schema-003.sql @@ -0,0 +1,53 @@ + +/* ---------------------------------------------------------------------- */ +/* Domains */ +/* ---------------------------------------------------------------------- */ + +CREATE DOMAIN TECH_ID AS BIGINT; + +CREATE DOMAIN CODE AS VARCHAR(40); + +CREATE DOMAIN FILE_PATH AS VARCHAR(1000); + +CREATE DOMAIN BOOLEAN_CHAR AS BOOLEAN DEFAULT FALSE; + +CREATE DOMAIN TIME_STAMP AS TIMESTAMP WITH TIME ZONE; + + +/* ---------------------------------------------------------------------- */ +/* Tables */ +/* ---------------------------------------------------------------------- */ + +CREATE TABLE DATA_SETS ( + ID BIGSERIAL NOT NULL, + CODE CODE NOT NULL, + LOCATION FILE_PATH NOT NULL, + + PRIMARY KEY (ID), + UNIQUE (CODE) +); + +CREATE INDEX DATA_SETS_CODE_IDX ON DATA_SETS (CODE); + +CREATE TABLE DATA_SET_FILES ( + ID BIGSERIAL NOT NULL, + DASE_ID TECH_ID NOT NULL, + PARENT_ID TECH_ID, + RELATIVE_PATH FILE_PATH NOT NULL, + FILE_NAME FILE_PATH NOT NULL, + SIZE_IN_BYTES BIGINT NOT NULL, + IS_DIRECTORY BOOLEAN_CHAR NOT NULL, + LAST_MODIFIED TIME_STAMP NOT NULL DEFAULT NOW(), + + PRIMARY KEY (ID), + CONSTRAINT FK_DATA_SET_FILES_DATA_SETS FOREIGN KEY (DASE_ID) REFERENCES DATA_SETS (ID) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT FK_DATA_SET_FILES_DATA_SET_FILES FOREIGN KEY (PARENT_ID) REFERENCES DATA_SET_FILES (ID) ON DELETE CASCADE ON UPDATE CASCADE +); + +CREATE INDEX DATA_SET_FILES_RELATIVE_PATH_IDX ON DATA_SET_FILES (RELATIVE_PATH); +CREATE INDEX DATA_SET_FILES_FILE_NAME_IDX ON DATA_SET_FILES (FILE_NAME); + +CREATE TABLE EVENTS ( + LAST_SEEN_DELETION_EVENT_ID TECH_ID NOT NULL +); + diff --git a/datastore_server/source/sql/postgresql/migration/migration-002-003.sql b/datastore_server/source/sql/postgresql/migration/migration-002-003.sql new file mode 100644 index 0000000000000000000000000000000000000000..217ea7507f9b8fa8434477fd8ee2d0aa48cc0d25 --- /dev/null +++ b/datastore_server/source/sql/postgresql/migration/migration-002-003.sql @@ -0,0 +1,8 @@ +---------------------------------------------------------------------- +-- +-- Migration script from version 2 to 3 of the database +-- +---------------------------------------------------------------------- +ALTER TABLE data_set_files ALTER COLUMN last_modified SET DEFAULT NOW(); +UPDATE data_set_files SET last_modified = DEFAULT WHERE last_modified IS NULL; +ALTER TABLE data_set_files ALTER COLUMN last_modified SET NOT NULL;