mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
Merge pull request #8822 from tdonohue/remove_oracle
Remove Oracle Support
This commit is contained in:
@@ -100,7 +100,7 @@ public class ResourcePolicy implements ReloadableEntity<Integer> {
|
||||
private String rptype;
|
||||
|
||||
@Lob
|
||||
@Type(type = "org.dspace.storage.rdbms.hibernate.DatabaseAwareLobType")
|
||||
@Type(type = "org.hibernate.type.TextType")
|
||||
@Column(name = "rpdescription")
|
||||
private String rpdescription;
|
||||
|
||||
|
@@ -60,7 +60,7 @@ public class MetadataValue implements ReloadableEntity<Integer> {
|
||||
* The value of the field
|
||||
*/
|
||||
@Lob
|
||||
@Type(type = "org.dspace.storage.rdbms.hibernate.DatabaseAwareLobType")
|
||||
@Type(type = "org.hibernate.type.TextType")
|
||||
@Column(name = "text_value")
|
||||
private String value;
|
||||
|
||||
|
@@ -353,8 +353,6 @@ public class GroupServiceImpl extends DSpaceObjectServiceImpl<Group> implements
|
||||
|
||||
List<Group2GroupCache> groupCache = group2GroupCacheDAO.findByChildren(context, groups);
|
||||
// now we have all owning groups, also grab all parents of owning groups
|
||||
// yes, I know this could have been done as one big query and a union,
|
||||
// but doing the Oracle port taught me to keep to simple SQL!
|
||||
for (Group2GroupCache group2GroupCache : groupCache) {
|
||||
groups.add(group2GroupCache.getParent());
|
||||
}
|
||||
|
@@ -80,7 +80,7 @@ public class OrcidHistory implements ReloadableEntity<Integer> {
|
||||
* A description of the synchronized resource.
|
||||
*/
|
||||
@Lob
|
||||
@Type(type = "org.dspace.storage.rdbms.hibernate.DatabaseAwareLobType")
|
||||
@Type(type = "org.hibernate.type.TextType")
|
||||
@Column(name = "description")
|
||||
private String description;
|
||||
|
||||
@@ -89,7 +89,7 @@ public class OrcidHistory implements ReloadableEntity<Integer> {
|
||||
* the owner itself.
|
||||
*/
|
||||
@Lob
|
||||
@Type(type = "org.dspace.storage.rdbms.hibernate.DatabaseAwareLobType")
|
||||
@Type(type = "org.hibernate.type.TextType")
|
||||
@Column(name = "metadata")
|
||||
private String metadata;
|
||||
|
||||
@@ -104,7 +104,7 @@ public class OrcidHistory implements ReloadableEntity<Integer> {
|
||||
* The response message incoming from ORCID.
|
||||
*/
|
||||
@Lob
|
||||
@Type(type = "org.dspace.storage.rdbms.hibernate.DatabaseAwareLobType")
|
||||
@Type(type = "org.hibernate.type.TextType")
|
||||
@Column(name = "response_message")
|
||||
private String responseMessage;
|
||||
|
||||
|
@@ -65,7 +65,7 @@ public class OrcidQueue implements ReloadableEntity<Integer> {
|
||||
* A description of the resource to be synchronized.
|
||||
*/
|
||||
@Lob
|
||||
@Type(type = "org.dspace.storage.rdbms.hibernate.DatabaseAwareLobType")
|
||||
@Type(type = "org.hibernate.type.TextType")
|
||||
@Column(name = "description")
|
||||
private String description;
|
||||
|
||||
@@ -89,7 +89,7 @@ public class OrcidQueue implements ReloadableEntity<Integer> {
|
||||
*/
|
||||
@Lob
|
||||
@Column(name = "metadata")
|
||||
@Type(type = "org.dspace.storage.rdbms.hibernate.DatabaseAwareLobType")
|
||||
@Type(type = "org.hibernate.type.TextType")
|
||||
private String metadata;
|
||||
|
||||
/**
|
||||
|
@@ -71,7 +71,7 @@ public class Process implements ReloadableEntity<Integer> {
|
||||
private ProcessStatus processStatus;
|
||||
|
||||
@Lob
|
||||
@Type(type = "org.dspace.storage.rdbms.hibernate.DatabaseAwareLobType")
|
||||
@Type(type = "org.hibernate.type.TextType")
|
||||
@Column(name = "parameters")
|
||||
private String parameters;
|
||||
|
||||
|
@@ -75,7 +75,6 @@ public class DatabaseUtils {
|
||||
|
||||
// Types of databases supported by DSpace. See getDbType()
|
||||
public static final String DBMS_POSTGRES = "postgres";
|
||||
public static final String DBMS_ORACLE = "oracle";
|
||||
public static final String DBMS_H2 = "h2";
|
||||
|
||||
// Name of the table that Flyway uses for its migration history
|
||||
@@ -369,9 +368,7 @@ public class DatabaseUtils {
|
||||
.println("\nWARNING: ALL DATA AND TABLES IN YOUR DATABASE WILL BE PERMANENTLY DELETED.\n");
|
||||
System.out.println("There is NO turning back from this action. Backup your DB before " +
|
||||
"continuing.");
|
||||
if (dbType.equals(DBMS_ORACLE)) {
|
||||
System.out.println("\nORACLE WARNING: your RECYCLEBIN will also be PURGED.\n");
|
||||
} else if (dbType.equals(DBMS_POSTGRES)) {
|
||||
if (dbType.equals(DBMS_POSTGRES)) {
|
||||
System.out.println(
|
||||
"\nPOSTGRES WARNING: the '" + PostgresUtils.PGCRYPTO + "' extension will be dropped " +
|
||||
"if it is in the same schema as the DSpace database.\n");
|
||||
@@ -467,11 +464,10 @@ public class DatabaseUtils {
|
||||
DatabaseMetaData meta = connection.getMetaData();
|
||||
String dbType = getDbType(connection);
|
||||
System.out.println("\nDatabase Type: " + dbType);
|
||||
if (dbType.equals(DBMS_ORACLE)) {
|
||||
System.out.println("====================================");
|
||||
System.out.println("WARNING: Oracle support is deprecated!");
|
||||
System.out.println("See https://github.com/DSpace/DSpace/issues/8214");
|
||||
System.out.println("=====================================");
|
||||
if (!dbType.equals(DBMS_POSTGRES) && !dbType.equals(DBMS_H2)) {
|
||||
System.err.println("====================================");
|
||||
System.err.println("ERROR: Database type " + dbType + " is UNSUPPORTED!");
|
||||
System.err.println("=====================================");
|
||||
}
|
||||
System.out.println("Database URL: " + meta.getURL());
|
||||
System.out.println("Database Schema: " + getSchemaName(connection));
|
||||
@@ -606,10 +602,6 @@ public class DatabaseUtils {
|
||||
String dbType = getDbType(connection);
|
||||
connection.close();
|
||||
|
||||
if (dbType.equals(DBMS_ORACLE)) {
|
||||
log.warn("ORACLE SUPPORT IS DEPRECATED! See https://github.com/DSpace/DSpace/issues/8214");
|
||||
}
|
||||
|
||||
// Determine location(s) where Flyway will load all DB migrations
|
||||
ArrayList<String> scriptLocations = new ArrayList<>();
|
||||
|
||||
@@ -946,26 +938,6 @@ public class DatabaseUtils {
|
||||
// First, run Flyway's clean command on database.
|
||||
// For MOST database types, this takes care of everything
|
||||
flyway.clean();
|
||||
|
||||
try (Connection connection = dataSource.getConnection()) {
|
||||
// Get info about which database type we are using
|
||||
String dbType = getDbType(connection);
|
||||
|
||||
// If this is Oracle, the only way to entirely clean the database
|
||||
// is to also purge the "Recyclebin". See:
|
||||
// http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_9018.htm
|
||||
if (dbType.equals(DBMS_ORACLE)) {
|
||||
PreparedStatement statement = null;
|
||||
try {
|
||||
statement = connection.prepareStatement("PURGE RECYCLEBIN");
|
||||
statement.executeQuery();
|
||||
} finally {
|
||||
if (statement != null && !statement.isClosed()) {
|
||||
statement.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (FlywayException fe) {
|
||||
// If any FlywayException (Runtime) is thrown, change it to a SQLException
|
||||
throw new SQLException("Flyway clean error occurred", fe);
|
||||
@@ -1214,11 +1186,6 @@ public class DatabaseUtils {
|
||||
// We need to filter by schema in PostgreSQL
|
||||
schemaFilter = true;
|
||||
break;
|
||||
case DBMS_ORACLE:
|
||||
// Oracle specific query for a sequence owned by our current DSpace user
|
||||
// NOTE: No need to filter by schema for Oracle, as Schema = User
|
||||
sequenceSQL = "SELECT COUNT(1) FROM user_sequences WHERE sequence_name=?";
|
||||
break;
|
||||
case DBMS_H2:
|
||||
// In H2, sequences are listed in the "information_schema.sequences" table
|
||||
// SEE: http://www.h2database.com/html/grammar.html#information_schema
|
||||
@@ -1322,11 +1289,6 @@ public class DatabaseUtils {
|
||||
// For PostgreSQL, the default schema is named "public"
|
||||
// See: http://www.postgresql.org/docs/9.0/static/ddl-schemas.html
|
||||
schema = "public";
|
||||
} else if (dbType.equals(DBMS_ORACLE)) {
|
||||
// For Oracle, default schema is actually the user account
|
||||
// See: http://stackoverflow.com/a/13341390
|
||||
DatabaseMetaData meta = connection.getMetaData();
|
||||
schema = meta.getUserName();
|
||||
} else {
|
||||
// For H2 (in memory), there is no such thing as a schema
|
||||
schema = null;
|
||||
@@ -1552,8 +1514,6 @@ public class DatabaseUtils {
|
||||
String dbms_lc = prodName.toLowerCase(Locale.ROOT);
|
||||
if (dbms_lc.contains("postgresql")) {
|
||||
return DBMS_POSTGRES;
|
||||
} else if (dbms_lc.contains("oracle")) {
|
||||
return DBMS_ORACLE;
|
||||
} else if (dbms_lc.contains("h2")) {
|
||||
// Used for unit testing only
|
||||
return DBMS_H2;
|
||||
|
@@ -1,57 +0,0 @@
|
||||
/**
|
||||
* The contents of this file are subject to the license and copyright
|
||||
* detailed in the LICENSE and NOTICE files at the root of the source
|
||||
* tree and available online at
|
||||
*
|
||||
* http://www.dspace.org/license/
|
||||
*/
|
||||
package org.dspace.storage.rdbms.hibernate;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.dspace.services.ConfigurationService;
|
||||
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||
import org.hibernate.type.AbstractSingleColumnStandardBasicType;
|
||||
import org.hibernate.type.descriptor.java.StringTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.ClobTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.LongVarcharTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
|
||||
/**
|
||||
* A Hibernate @Type used to properly support the CLOB in both Postgres and Oracle.
|
||||
* PostgreSQL doesn't have a CLOB type, instead it's a TEXT field.
|
||||
* Normally, you'd use org.hibernate.type.TextType to support TEXT, but that won't work for Oracle.
|
||||
* https://github.com/hibernate/hibernate-orm/blob/5.6/hibernate-core/src/main/java/org/hibernate/type/TextType.java
|
||||
*
|
||||
* This Type checks if we are using PostgreSQL.
|
||||
* If so, it configures Hibernate to map CLOB to LongVarChar (same as org.hibernate.type.TextType)
|
||||
* If not, it uses default CLOB (which works for other databases).
|
||||
*/
|
||||
public class DatabaseAwareLobType extends AbstractSingleColumnStandardBasicType<String> {
|
||||
|
||||
public static final DatabaseAwareLobType INSTANCE = new DatabaseAwareLobType();
|
||||
|
||||
public DatabaseAwareLobType() {
|
||||
super( getDbDescriptor(), StringTypeDescriptor.INSTANCE );
|
||||
}
|
||||
|
||||
public static SqlTypeDescriptor getDbDescriptor() {
|
||||
if ( isPostgres() ) {
|
||||
return LongVarcharTypeDescriptor.INSTANCE;
|
||||
} else {
|
||||
return ClobTypeDescriptor.DEFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isPostgres() {
|
||||
ConfigurationService configurationService = DSpaceServicesFactory.getInstance().getConfigurationService();
|
||||
String dbDialect = configurationService.getProperty("db.dialect");
|
||||
|
||||
return StringUtils.containsIgnoreCase(dbDialect, "PostgreSQL");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "database_aware_lob";
|
||||
}
|
||||
}
|
||||
|
@@ -78,13 +78,6 @@ public class MigrationUtils {
|
||||
constraintName += "_" + StringUtils.lowerCase(constraintSuffix);
|
||||
cascade = true;
|
||||
break;
|
||||
case "oracle":
|
||||
// In Oracle, constraints are listed in the USER_CONS_COLUMNS table
|
||||
constraintNameSQL = "SELECT CONSTRAINT_NAME " +
|
||||
"FROM USER_CONS_COLUMNS " +
|
||||
"WHERE TABLE_NAME = ? AND COLUMN_NAME = ?";
|
||||
cascade = true;
|
||||
break;
|
||||
case "h2":
|
||||
// In H2, column constraints are listed in the "INFORMATION_SCHEMA.KEY_COLUMN_USAGE" table
|
||||
constraintNameSQL = "SELECT DISTINCT CONSTRAINT_NAME " +
|
||||
@@ -160,9 +153,6 @@ public class MigrationUtils {
|
||||
case "postgresql":
|
||||
dropTableSQL = "DROP TABLE IF EXISTS " + tableName + " CASCADE";
|
||||
break;
|
||||
case "oracle":
|
||||
dropTableSQL = "DROP TABLE " + tableName + " CASCADE CONSTRAINTS";
|
||||
break;
|
||||
case "h2":
|
||||
dropTableSQL = "DROP TABLE IF EXISTS " + tableName + " CASCADE";
|
||||
break;
|
||||
@@ -208,9 +198,6 @@ public class MigrationUtils {
|
||||
case "postgresql":
|
||||
dropSequenceSQL = "DROP SEQUENCE IF EXISTS " + sequenceName;
|
||||
break;
|
||||
case "oracle":
|
||||
dropSequenceSQL = "DROP SEQUENCE " + sequenceName;
|
||||
break;
|
||||
case "h2":
|
||||
dropSequenceSQL = "DROP SEQUENCE IF EXISTS " + sequenceName;
|
||||
break;
|
||||
@@ -256,9 +243,6 @@ public class MigrationUtils {
|
||||
case "postgresql":
|
||||
dropViewSQL = "DROP VIEW IF EXISTS " + viewName + " CASCADE";
|
||||
break;
|
||||
case "oracle":
|
||||
dropViewSQL = "DROP VIEW " + viewName + " CASCADE CONSTRAINTS";
|
||||
break;
|
||||
case "h2":
|
||||
dropViewSQL = "DROP VIEW IF EXISTS " + viewName + " CASCADE";
|
||||
break;
|
||||
|
@@ -19,10 +19,9 @@ import org.flywaydb.core.api.migration.Context;
|
||||
* of the "community" table. This is necessary for the upgrade from 1.3 to 1.4
|
||||
* <P>
|
||||
* This class was created because the names of database constraints differs based
|
||||
* on the type of database (Postgres vs. Oracle vs. H2). As such, it becomes difficult
|
||||
* on the type of database (Postgres vs. H2). As such, it becomes difficult
|
||||
* to write simple SQL which will work for multiple database types (especially
|
||||
* since unit tests require H2 and the syntax for H2 is different from either
|
||||
* Oracle or Postgres).
|
||||
* since unit tests require H2 and the syntax for H2 is different from Postgres).
|
||||
* <P>
|
||||
* NOTE: This migration class is very simple because it is meant to be used
|
||||
* in conjuction with the corresponding SQL script:
|
||||
|
@@ -19,10 +19,9 @@ import org.flywaydb.core.api.migration.Context;
|
||||
* from 1.5 to 1.6
|
||||
* <P>
|
||||
* This class was created because the names of database constraints differs based
|
||||
* on the type of database (Postgres vs. Oracle vs. H2). As such, it becomes difficult
|
||||
* on the type of database (Postgres vs. H2). As such, it becomes difficult
|
||||
* to write simple SQL which will work for multiple database types (especially
|
||||
* since unit tests require H2 and the syntax for H2 is different from either
|
||||
* Oracle or Postgres).
|
||||
* since unit tests require H2 and the syntax for H2 is different from Postgres).
|
||||
* <P>
|
||||
* NOTE: This migration class is very simple because it is meant to be used
|
||||
* in conjuction with the corresponding SQL script:
|
||||
|
@@ -20,10 +20,9 @@ import org.flywaydb.core.api.migration.Context;
|
||||
* this column must be renamed to "resource_id".
|
||||
* <P>
|
||||
* This class was created because the names of database constraints differs based
|
||||
* on the type of database (Postgres vs. Oracle vs. H2). As such, it becomes difficult
|
||||
* on the type of database (Postgres vs. H2). As such, it becomes difficult
|
||||
* to write simple SQL which will work for multiple database types (especially
|
||||
* since unit tests require H2 and the syntax for H2 is different from either
|
||||
* Oracle or Postgres).
|
||||
* since unit tests require H2 and the syntax for H2 is different from Postgres).
|
||||
* <P>
|
||||
* NOTE: This migration class is very simple because it is meant to be used
|
||||
* in conjuction with the corresponding SQL script:
|
||||
|
@@ -67,8 +67,6 @@ public class V5_0_2014_11_04__Enable_XMLWorkflow_Migration
|
||||
String dbFileLocation = null;
|
||||
if (dbtype.toLowerCase().contains("postgres")) {
|
||||
dbFileLocation = "postgres";
|
||||
} else if (dbtype.toLowerCase().contains("oracle")) {
|
||||
dbFileLocation = "oracle";
|
||||
} else if (dbtype.toLowerCase().contains("h2")) {
|
||||
dbFileLocation = "h2";
|
||||
}
|
||||
|
@@ -46,8 +46,6 @@ public class V6_0_2015_09_01__DS_2701_Enable_XMLWorkflow_Migration extends BaseJ
|
||||
String dbFileLocation = null;
|
||||
if (dbtype.toLowerCase().contains("postgres")) {
|
||||
dbFileLocation = "postgres";
|
||||
} else if (dbtype.toLowerCase().contains("oracle")) {
|
||||
dbFileLocation = "oracle";
|
||||
} else if (dbtype.toLowerCase().contains("h2")) {
|
||||
dbFileLocation = "h2";
|
||||
}
|
||||
|
@@ -1,29 +0,0 @@
|
||||
--
|
||||
-- Copyright 2010-2017 Boxfuse GmbH
|
||||
--
|
||||
-- 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.
|
||||
--
|
||||
-----------------
|
||||
-- This is the Oracle upgrade script from Flyway v4.2.0, copied/borrowed from:
|
||||
-- https://github.com/flyway/flyway/blob/flyway-4.2.0/flyway-core/src/main/resources/org/flywaydb/core/internal/dbsupport/oracle/upgradeMetaDataTable.sql
|
||||
--
|
||||
-- The variables in this script are replaced in FlywayUpgradeUtils.upgradeFlywayTable()
|
||||
------------------
|
||||
|
||||
DROP INDEX "${schema}"."${table}_vr_idx";
|
||||
DROP INDEX "${schema}"."${table}_ir_idx";
|
||||
ALTER TABLE "${schema}"."${table}" DROP COLUMN "version_rank";
|
||||
ALTER TABLE "${schema}"."${table}" DROP PRIMARY KEY DROP INDEX;
|
||||
ALTER TABLE "${schema}"."${table}" MODIFY "version" NULL;
|
||||
ALTER TABLE "${schema}"."${table}" ADD CONSTRAINT "${table}_pk" PRIMARY KEY ("installed_rank");
|
||||
UPDATE "${schema}"."${table}" SET "type"='BASELINE' WHERE "type"='INIT';
|
@@ -15,7 +15,7 @@
|
||||
--
|
||||
-----------------
|
||||
-- This is the PostgreSQL upgrade script from Flyway v4.2.0, copied/borrowed from:
|
||||
-- https://github.com/flyway/flyway/blob/flyway-4.2.0/flyway-core/src/main/resources/org/flywaydb/core/internal/dbsupport/oracle/upgradeMetaDataTable.sql
|
||||
-- https://github.com/flyway/flyway/blob/flyway-4.2.0/flyway-core/src/main/resources/org/flywaydb/core/internal/dbsupport/postgresql/upgradeMetaDataTable.sql
|
||||
--
|
||||
-- The variables in this script are replaced in FlywayUpgradeUtils.upgradeFlywayTable()
|
||||
------------------
|
||||
|
@@ -4,33 +4,25 @@
|
||||
in Production. Instead, DSpace uses the H2 Database to perform Unit Testing
|
||||
during development.
|
||||
|
||||
By default, the DSpace Unit Testing environment configures H2 to run in
|
||||
"Oracle Mode" and initializes the H2 database using the scripts in this directory.
|
||||
By default, the DSpace Unit Testing environment configures H2 to run in memory
|
||||
and initializes the H2 database using the scripts in this directory. See
|
||||
`[src]/dspace-api/src/test/data/dspaceFolder/config/local.cfg`.
|
||||
|
||||
These database migrations are automatically called by [Flyway](http://flywaydb.org/)
|
||||
when the `DatabaseManager` initializes itself (see `initializeDatabase()` method).
|
||||
in `DatabaseUtils`.
|
||||
|
||||
The H2 migrations in this directory are *based on* the Oracle Migrations, but
|
||||
with some modifications in order to be valid in H2.
|
||||
The H2 migrations in this directory all use H2's grammar/syntax.
|
||||
For additional info see the [H2 SQL Grammar](https://www.h2database.com/html/grammar.html).
|
||||
|
||||
## Oracle vs H2 script differences
|
||||
|
||||
One of the primary differences between the Oracle scripts and these H2 ones
|
||||
is in the syntax of the `ALTER TABLE` command. Unfortunately, H2's syntax for
|
||||
that command differs greatly from Oracle (and PostgreSQL as well).
|
||||
|
||||
Most of the remainder of the scripts contain the exact Oracle syntax (which is
|
||||
usually valid in H2). But, to you can always `diff` scripts of the same name
|
||||
for further syntax differences.
|
||||
|
||||
For additional info see the [H2 SQL Grammar](http://www.h2database.com/html/grammar.html).
|
||||
|
||||
## More Information on Flyway
|
||||
|
||||
The SQL scripts in this directory are H2-specific database migrations. They are
|
||||
used to automatically upgrade your DSpace database using [Flyway](http://flywaydb.org/).
|
||||
As such, these scripts are automatically called by Flyway when the DSpace
|
||||
`DatabaseManager` initializes itself (see `initializeDatabase()` method). During
|
||||
that process, Flyway determines which version of DSpace your database is using
|
||||
`DatabaseUtils` initializes.
|
||||
|
||||
During that process, Flyway determines which version of DSpace your database is using
|
||||
and then executes the appropriate upgrade script(s) to bring it up to the latest
|
||||
version.
|
||||
|
||||
|
@@ -1,90 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-- ===============================================================
|
||||
-- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
||||
--
|
||||
-- DO NOT MANUALLY RUN THIS DATABASE MIGRATION. IT WILL BE EXECUTED
|
||||
-- AUTOMATICALLY (IF NEEDED) BY "FLYWAY" WHEN YOU STARTUP DSPACE.
|
||||
-- http://flywaydb.org/
|
||||
-- ===============================================================
|
||||
|
||||
-------------------------------------------------------------
|
||||
-- This will create COMMUNITY handle metadata
|
||||
-------------------------------------------------------------
|
||||
|
||||
insert into metadatavalue (metadata_field_id, text_value, text_lang, place, authority, confidence, dspace_object_id)
|
||||
select distinct
|
||||
T1.metadata_field_id as metadata_field_id,
|
||||
concat('${handle.canonical.prefix}', h.handle) as text_value,
|
||||
null as text_lang, 0 as place,
|
||||
null as authority,
|
||||
-1 as confidence,
|
||||
c.uuid as dspace_object_id
|
||||
|
||||
from community c
|
||||
left outer join handle h on h.resource_id = c.uuid
|
||||
left outer join metadatavalue mv on mv.dspace_object_id = c.uuid
|
||||
left outer join metadatafieldregistry mfr on mv.metadata_field_id = mfr.metadata_field_id
|
||||
left outer join metadataschemaregistry msr on mfr.metadata_schema_id = msr.metadata_schema_id
|
||||
|
||||
cross join (select mfr.metadata_field_id as metadata_field_id from metadatafieldregistry mfr
|
||||
left outer join metadataschemaregistry msr on mfr.metadata_schema_id = msr.metadata_schema_id
|
||||
where msr.short_id = 'dc'
|
||||
and mfr.element = 'identifier'
|
||||
and mfr.qualifier = 'uri') T1
|
||||
|
||||
where uuid not in (
|
||||
select c.uuid as uuid from community c
|
||||
left outer join handle h on h.resource_id = c.uuid
|
||||
left outer join metadatavalue mv on mv.dspace_object_id = c.uuid
|
||||
left outer join metadatafieldregistry mfr on mv.metadata_field_id = mfr.metadata_field_id
|
||||
left outer join metadataschemaregistry msr on mfr.metadata_schema_id = msr.metadata_schema_id
|
||||
where msr.short_id = 'dc'
|
||||
and mfr.element = 'identifier'
|
||||
and mfr.qualifier = 'uri'
|
||||
)
|
||||
;
|
||||
|
||||
-------------------------------------------------------------
|
||||
-- This will create COLLECTION handle metadata
|
||||
-------------------------------------------------------------
|
||||
|
||||
insert into metadatavalue (metadata_field_id, text_value, text_lang, place, authority, confidence, dspace_object_id)
|
||||
select distinct
|
||||
T1.metadata_field_id as metadata_field_id,
|
||||
concat('${handle.canonical.prefix}', h.handle) as text_value,
|
||||
null as text_lang, 0 as place,
|
||||
null as authority,
|
||||
-1 as confidence,
|
||||
c.uuid as dspace_object_id
|
||||
|
||||
from collection c
|
||||
left outer join handle h on h.resource_id = c.uuid
|
||||
left outer join metadatavalue mv on mv.dspace_object_id = c.uuid
|
||||
left outer join metadatafieldregistry mfr on mv.metadata_field_id = mfr.metadata_field_id
|
||||
left outer join metadataschemaregistry msr on mfr.metadata_schema_id = msr.metadata_schema_id
|
||||
|
||||
cross join (select mfr.metadata_field_id as metadata_field_id from metadatafieldregistry mfr
|
||||
left outer join metadataschemaregistry msr on mfr.metadata_schema_id = msr.metadata_schema_id
|
||||
where msr.short_id = 'dc'
|
||||
and mfr.element = 'identifier'
|
||||
and mfr.qualifier = 'uri') T1
|
||||
|
||||
where uuid not in (
|
||||
select c.uuid as uuid from collection c
|
||||
left outer join handle h on h.resource_id = c.uuid
|
||||
left outer join metadatavalue mv on mv.dspace_object_id = c.uuid
|
||||
left outer join metadatafieldregistry mfr on mv.metadata_field_id = mfr.metadata_field_id
|
||||
left outer join metadataschemaregistry msr on mfr.metadata_schema_id = msr.metadata_schema_id
|
||||
where msr.short_id = 'dc'
|
||||
and mfr.element = 'identifier'
|
||||
and mfr.qualifier = 'uri'
|
||||
)
|
||||
;
|
||||
|
@@ -1,84 +0,0 @@
|
||||
# Oracle Flyway Database Migrations (i.e. Upgrades)
|
||||
|
||||
---
|
||||
WARNING: Oracle Support is deprecated.
|
||||
See https://github.com/DSpace/DSpace/issues/8214
|
||||
---
|
||||
|
||||
The SQL scripts in this directory are Oracle-specific database migrations. They are
|
||||
used to automatically upgrade your DSpace database using [Flyway](http://flywaydb.org/).
|
||||
As such, these scripts are automatically called by Flyway when the DSpace
|
||||
`DatabaseManager` initializes itself (see `initializeDatabase()` method). During
|
||||
that process, Flyway determines which version of DSpace your database is using
|
||||
and then executes the appropriate upgrade script(s) to bring it up to the latest
|
||||
version.
|
||||
|
||||
If any failures occur, Flyway will "rollback" the upgrade script which resulted
|
||||
in an error and log the issue in the DSpace log file at `[dspace]/log/dspace.log.[date]`
|
||||
|
||||
**WARNING:** IT IS NOT RECOMMENDED TO RUN THESE SCRIPTS MANUALLY. If you do so,
|
||||
Flyway will may throw failures the next time you startup DSpace, as Flyway will
|
||||
not realize you manually ran one or more scripts.
|
||||
|
||||
Please see the Flyway Documentation for more information: http://flywaydb.org/
|
||||
|
||||
## Oracle Porting Notes for the Curious
|
||||
|
||||
Oracle is missing quite a number of cool features found in Postgres, so
|
||||
workarounds had to be found, most of which are hidden behind tests in
|
||||
DatabaseManager. If Oracle is your DBMS, the workarounds are activated:
|
||||
|
||||
Oracle doesn't like ';' characters in JDBC SQL - they have all been removed
|
||||
from the DSpace source, including code in the .sql file reader to strip ;'s.
|
||||
|
||||
browse code - LIMIT and OFFSET is used to limit browse results, and an
|
||||
Oracle-hack is used to limit the result set to a given size
|
||||
|
||||
Oracle has no boolean data type, so a new schema file was created that
|
||||
uses NUMBER(1) (AKA 'integers') and code is inserted everywhere to use 0 for
|
||||
false and 1 for true if DSpace is using Oracle.
|
||||
|
||||
Oracle doesn't have a TEXT data type either, so TEXT columns are defined
|
||||
as VARCHAR2 in the Oracle-specific schema.
|
||||
|
||||
Oracle doesn't allow dynamic naming for objects, so our cute trick to
|
||||
derive the name of the sequence by appending _seq to the table name
|
||||
in a function doesn't work in Oracle - workaround is to insert Oracle
|
||||
code to generate the name of the sequence and then place that into
|
||||
our SQL calls to generate a new ID.
|
||||
|
||||
Oracle doesn't let you directly set the value of sequences, so
|
||||
update-sequences.sql is forced to use a special script sequpdate.sql
|
||||
to update the sequences.
|
||||
|
||||
Bitstream had a column 'size' which is a reserved word in Oracle,
|
||||
so this had to be changed to 'size_bytes' with corresponding code changes.
|
||||
|
||||
VARCHAR2 has a limit of 4000 characters, so DSpace text data is limited to 4k.
|
||||
Going to the CLOB data type can get around that, but seemed like too much effort
|
||||
for now. Note that with UTF-8 encoding that 4k could translate to 1300
|
||||
characters worst-case (every character taking up 3 bytes is the worst case
|
||||
scenario.)
|
||||
|
||||
### UPDATE 5 April 2007
|
||||
|
||||
CLOBs are now used as follows:
|
||||
MetadataValue:text_value
|
||||
Community:introductory_text
|
||||
Community:copyright_text
|
||||
Collection:introductory_text
|
||||
Collection:license
|
||||
Collection:copyright_text
|
||||
|
||||
DatabaseManager had to have some of the type checking changed, because Oracle's
|
||||
JDBC driver is reporting INTEGERS as type DECIMAL.
|
||||
|
||||
Oracle doesn't like it when you reference table names in lower case when
|
||||
getting JDBC metadata for the tables, so they are converted in TableRow
|
||||
to upper case.
|
||||
|
||||
### UPDATE 27 November 2012
|
||||
|
||||
Oracle complains with ORA-01408 if you attempt to create an index on a column which
|
||||
has already had the UNIQUE contraint added (such an index is implicit in maintaining the uniqueness
|
||||
of the column). See [DS-1370](https://jira.duraspace.org/browse/DS-1370) for details.
|
@@ -1,550 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-- ===============================================================
|
||||
-- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
||||
--
|
||||
-- DO NOT MANUALLY RUN THIS DATABASE MIGRATION. IT WILL BE EXECUTED
|
||||
-- AUTOMATICALLY (IF NEEDED) BY "FLYWAY" WHEN YOU STARTUP DSPACE.
|
||||
-- http://flywaydb.org/
|
||||
-- ===============================================================
|
||||
|
||||
CREATE SEQUENCE bitstreamformatregistry_seq;
|
||||
CREATE SEQUENCE fileextension_seq;
|
||||
CREATE SEQUENCE bitstream_seq;
|
||||
CREATE SEQUENCE eperson_seq;
|
||||
-- start group sequence at 0, since Anonymous group = 0
|
||||
CREATE SEQUENCE epersongroup_seq MINVALUE 0 START WITH 0;
|
||||
CREATE SEQUENCE item_seq;
|
||||
CREATE SEQUENCE bundle_seq;
|
||||
CREATE SEQUENCE item2bundle_seq;
|
||||
CREATE SEQUENCE bundle2bitstream_seq;
|
||||
CREATE SEQUENCE dctyperegistry_seq;
|
||||
CREATE SEQUENCE dcvalue_seq;
|
||||
CREATE SEQUENCE community_seq;
|
||||
CREATE SEQUENCE collection_seq;
|
||||
CREATE SEQUENCE community2community_seq;
|
||||
CREATE SEQUENCE community2collection_seq;
|
||||
CREATE SEQUENCE collection2item_seq;
|
||||
CREATE SEQUENCE resourcepolicy_seq;
|
||||
CREATE SEQUENCE epersongroup2eperson_seq;
|
||||
CREATE SEQUENCE handle_seq;
|
||||
CREATE SEQUENCE workspaceitem_seq;
|
||||
CREATE SEQUENCE workflowitem_seq;
|
||||
CREATE SEQUENCE tasklistitem_seq;
|
||||
CREATE SEQUENCE registrationdata_seq;
|
||||
CREATE SEQUENCE subscription_seq;
|
||||
CREATE SEQUENCE history_seq;
|
||||
CREATE SEQUENCE historystate_seq;
|
||||
CREATE SEQUENCE communities2item_seq;
|
||||
CREATE SEQUENCE itemsbyauthor_seq;
|
||||
CREATE SEQUENCE itemsbytitle_seq;
|
||||
CREATE SEQUENCE itemsbydate_seq;
|
||||
CREATE SEQUENCE itemsbydateaccessioned_seq;
|
||||
|
||||
|
||||
-------------------------------------------------------
|
||||
-- BitstreamFormatRegistry table
|
||||
-------------------------------------------------------
|
||||
CREATE TABLE BitstreamFormatRegistry
|
||||
(
|
||||
bitstream_format_id INTEGER PRIMARY KEY,
|
||||
mimetype VARCHAR2(48),
|
||||
short_description VARCHAR2(128) UNIQUE,
|
||||
description VARCHAR2(2000),
|
||||
support_level INTEGER,
|
||||
-- Identifies internal types
|
||||
internal NUMBER(1)
|
||||
);
|
||||
|
||||
-------------------------------------------------------
|
||||
-- FileExtension table
|
||||
-------------------------------------------------------
|
||||
CREATE TABLE FileExtension
|
||||
(
|
||||
file_extension_id INTEGER PRIMARY KEY,
|
||||
bitstream_format_id INTEGER REFERENCES BitstreamFormatRegistry(bitstream_format_id),
|
||||
extension VARCHAR2(16)
|
||||
);
|
||||
|
||||
-------------------------------------------------------
|
||||
-- Bitstream table
|
||||
-------------------------------------------------------
|
||||
CREATE TABLE Bitstream
|
||||
(
|
||||
bitstream_id INTEGER PRIMARY KEY,
|
||||
bitstream_format_id INTEGER REFERENCES BitstreamFormatRegistry(bitstream_format_id),
|
||||
name VARCHAR2(256),
|
||||
size_bytes INTEGER,
|
||||
checksum VARCHAR2(64),
|
||||
checksum_algorithm VARCHAR2(32),
|
||||
description VARCHAR2(2000),
|
||||
user_format_description VARCHAR2(2000),
|
||||
source VARCHAR2(256),
|
||||
internal_id VARCHAR2(256),
|
||||
deleted NUMBER(1),
|
||||
store_number INTEGER,
|
||||
sequence_id INTEGER
|
||||
);
|
||||
|
||||
-------------------------------------------------------
|
||||
-- EPerson table
|
||||
-------------------------------------------------------
|
||||
CREATE TABLE EPerson
|
||||
(
|
||||
eperson_id INTEGER PRIMARY KEY,
|
||||
email VARCHAR2(64) UNIQUE,
|
||||
password VARCHAR2(64),
|
||||
firstname VARCHAR2(64),
|
||||
lastname VARCHAR2(64),
|
||||
can_log_in NUMBER(1),
|
||||
require_certificate NUMBER(1),
|
||||
self_registered NUMBER(1),
|
||||
last_active TIMESTAMP,
|
||||
sub_frequency INTEGER,
|
||||
phone VARCHAR2(32)
|
||||
);
|
||||
|
||||
-------------------------------------------------------
|
||||
-- EPersonGroup table
|
||||
-------------------------------------------------------
|
||||
CREATE TABLE EPersonGroup
|
||||
(
|
||||
eperson_group_id INTEGER PRIMARY KEY,
|
||||
name VARCHAR2(256) UNIQUE
|
||||
);
|
||||
|
||||
-------------------------------------------------------
|
||||
-- Item table
|
||||
-------------------------------------------------------
|
||||
CREATE TABLE Item
|
||||
(
|
||||
item_id INTEGER PRIMARY KEY,
|
||||
submitter_id INTEGER REFERENCES EPerson(eperson_id),
|
||||
in_archive NUMBER(1),
|
||||
withdrawn NUMBER(1),
|
||||
last_modified TIMESTAMP,
|
||||
owning_collection INTEGER
|
||||
);
|
||||
|
||||
-------------------------------------------------------
|
||||
-- Bundle table
|
||||
-------------------------------------------------------
|
||||
CREATE TABLE Bundle
|
||||
(
|
||||
bundle_id INTEGER PRIMARY KEY,
|
||||
mets_bitstream_id INTEGER REFERENCES Bitstream(bitstream_id),
|
||||
name VARCHAR2(16), -- ORIGINAL | THUMBNAIL | TEXT
|
||||
primary_bitstream_id INTEGER REFERENCES Bitstream(bitstream_id)
|
||||
);
|
||||
|
||||
-------------------------------------------------------
|
||||
-- Item2Bundle table
|
||||
-------------------------------------------------------
|
||||
CREATE TABLE Item2Bundle
|
||||
(
|
||||
id INTEGER PRIMARY KEY,
|
||||
item_id INTEGER REFERENCES Item(item_id),
|
||||
bundle_id INTEGER REFERENCES Bundle(bundle_id)
|
||||
);
|
||||
|
||||
-- index by item_id
|
||||
CREATE INDEX item2bundle_item_idx on Item2Bundle(item_id);
|
||||
|
||||
-------------------------------------------------------
|
||||
-- Bundle2Bitstream table
|
||||
-------------------------------------------------------
|
||||
CREATE TABLE Bundle2Bitstream
|
||||
(
|
||||
id INTEGER PRIMARY KEY,
|
||||
bundle_id INTEGER REFERENCES Bundle(bundle_id),
|
||||
bitstream_id INTEGER REFERENCES Bitstream(bitstream_id)
|
||||
);
|
||||
|
||||
-- index by bundle_id
|
||||
CREATE INDEX bundle2bitstream_bundle_idx ON Bundle2Bitstream(bundle_id);
|
||||
|
||||
-------------------------------------------------------
|
||||
-- DCTypeRegistry table
|
||||
-------------------------------------------------------
|
||||
CREATE TABLE DCTypeRegistry
|
||||
(
|
||||
dc_type_id INTEGER PRIMARY KEY,
|
||||
element VARCHAR2(64),
|
||||
qualifier VARCHAR2(64),
|
||||
scope_note VARCHAR2(2000),
|
||||
UNIQUE(element, qualifier)
|
||||
);
|
||||
|
||||
-------------------------------------------------------
|
||||
-- DCValue table
|
||||
-------------------------------------------------------
|
||||
CREATE TABLE DCValue
|
||||
(
|
||||
dc_value_id INTEGER PRIMARY KEY,
|
||||
item_id INTEGER REFERENCES Item(item_id),
|
||||
dc_type_id INTEGER REFERENCES DCTypeRegistry(dc_type_id),
|
||||
text_value VARCHAR2(2000),
|
||||
text_lang VARCHAR2(24),
|
||||
place INTEGER,
|
||||
source_id INTEGER
|
||||
);
|
||||
|
||||
-- An index for item_id - almost all access is based on
|
||||
-- instantiating the item object, which grabs all dcvalues
|
||||
-- related to that item
|
||||
CREATE INDEX dcvalue_item_idx on DCValue(item_id);
|
||||
|
||||
-------------------------------------------------------
|
||||
-- Community table
|
||||
-------------------------------------------------------
|
||||
CREATE TABLE Community
|
||||
(
|
||||
community_id INTEGER PRIMARY KEY,
|
||||
name VARCHAR2(128) UNIQUE,
|
||||
short_description VARCHAR2(512),
|
||||
introductory_text VARCHAR2(2000),
|
||||
logo_bitstream_id INTEGER REFERENCES Bitstream(bitstream_id),
|
||||
copyright_text VARCHAR2(2000),
|
||||
side_bar_text VARCHAR2(2000)
|
||||
);
|
||||
|
||||
-------------------------------------------------------
|
||||
-- Collection table
|
||||
-------------------------------------------------------
|
||||
CREATE TABLE Collection
|
||||
(
|
||||
collection_id INTEGER PRIMARY KEY,
|
||||
name VARCHAR2(128),
|
||||
short_description VARCHAR2(512),
|
||||
introductory_text VARCHAR2(2000),
|
||||
logo_bitstream_id INTEGER REFERENCES Bitstream(bitstream_id),
|
||||
template_item_id INTEGER REFERENCES Item(item_id),
|
||||
provenance_description VARCHAR2(2000),
|
||||
license VARCHAR2(2000),
|
||||
copyright_text VARCHAR2(2000),
|
||||
side_bar_text VARCHAR2(2000),
|
||||
workflow_step_1 INTEGER REFERENCES EPersonGroup( eperson_group_id ),
|
||||
workflow_step_2 INTEGER REFERENCES EPersonGroup( eperson_group_id ),
|
||||
workflow_step_3 INTEGER REFERENCES EPersonGroup( eperson_group_id )
|
||||
);
|
||||
|
||||
-------------------------------------------------------
|
||||
-- Community2Community table
|
||||
-------------------------------------------------------
|
||||
CREATE TABLE Community2Community
|
||||
(
|
||||
id INTEGER PRIMARY KEY,
|
||||
parent_comm_id INTEGER REFERENCES Community(community_id),
|
||||
child_comm_id INTEGER REFERENCES Community(community_id)
|
||||
);
|
||||
|
||||
-------------------------------------------------------
|
||||
-- Community2Collection table
|
||||
-------------------------------------------------------
|
||||
CREATE TABLE Community2Collection
|
||||
(
|
||||
id INTEGER PRIMARY KEY,
|
||||
community_id INTEGER REFERENCES Community(community_id),
|
||||
collection_id INTEGER REFERENCES Collection(collection_id)
|
||||
);
|
||||
|
||||
-------------------------------------------------------
|
||||
-- Collection2Item table
|
||||
-------------------------------------------------------
|
||||
CREATE TABLE Collection2Item
|
||||
(
|
||||
id INTEGER PRIMARY KEY,
|
||||
collection_id INTEGER REFERENCES Collection(collection_id),
|
||||
item_id INTEGER REFERENCES Item(item_id)
|
||||
);
|
||||
|
||||
-- index by collection_id
|
||||
CREATE INDEX collection2item_collection_idx ON Collection2Item(collection_id);
|
||||
|
||||
-------------------------------------------------------
|
||||
-- ResourcePolicy table
|
||||
-------------------------------------------------------
|
||||
CREATE TABLE ResourcePolicy
|
||||
(
|
||||
policy_id INTEGER PRIMARY KEY,
|
||||
resource_type_id INTEGER,
|
||||
resource_id INTEGER,
|
||||
action_id INTEGER,
|
||||
eperson_id INTEGER REFERENCES EPerson(eperson_id),
|
||||
epersongroup_id INTEGER REFERENCES EPersonGroup(eperson_group_id),
|
||||
start_date DATE,
|
||||
end_date DATE
|
||||
);
|
||||
|
||||
-- index by resource_type,resource_id - all queries by
|
||||
-- authorization manager are select type=x, id=y, action=z
|
||||
CREATE INDEX resourcepolicy_type_id_idx ON ResourcePolicy(resource_type_id,resource_id);
|
||||
|
||||
-------------------------------------------------------
|
||||
-- EPersonGroup2EPerson table
|
||||
-------------------------------------------------------
|
||||
CREATE TABLE EPersonGroup2EPerson
|
||||
(
|
||||
id INTEGER PRIMARY KEY,
|
||||
eperson_group_id INTEGER REFERENCES EPersonGroup(eperson_group_id),
|
||||
eperson_id INTEGER REFERENCES EPerson(eperson_id)
|
||||
);
|
||||
|
||||
-- Index by group ID (used heavily by AuthorizeManager)
|
||||
CREATE INDEX epersongroup2eperson_group_idx on EPersonGroup2EPerson(eperson_group_id);
|
||||
|
||||
|
||||
-------------------------------------------------------
|
||||
-- Handle table
|
||||
-------------------------------------------------------
|
||||
CREATE TABLE Handle
|
||||
(
|
||||
handle_id INTEGER PRIMARY KEY,
|
||||
handle VARCHAR2(256) UNIQUE,
|
||||
resource_type_id INTEGER,
|
||||
resource_id INTEGER
|
||||
);
|
||||
|
||||
-------------------------------------------------------
|
||||
-- WorkspaceItem table
|
||||
-------------------------------------------------------
|
||||
CREATE TABLE WorkspaceItem
|
||||
(
|
||||
workspace_item_id INTEGER PRIMARY KEY,
|
||||
item_id INTEGER REFERENCES Item(item_id),
|
||||
collection_id INTEGER REFERENCES Collection(collection_id),
|
||||
-- Answers to questions on first page of submit UI
|
||||
multiple_titles NUMBER(1), -- boolean
|
||||
published_before NUMBER(1),
|
||||
multiple_files NUMBER(1),
|
||||
-- How for the user has got in the submit process
|
||||
stage_reached INTEGER
|
||||
);
|
||||
|
||||
-------------------------------------------------------
|
||||
-- WorkflowItem table
|
||||
-------------------------------------------------------
|
||||
CREATE TABLE WorkflowItem
|
||||
(
|
||||
workflow_id INTEGER PRIMARY KEY,
|
||||
item_id INTEGER UNIQUE REFERENCES Item(item_id),
|
||||
collection_id INTEGER REFERENCES Collection(collection_id),
|
||||
state INTEGER,
|
||||
owner INTEGER REFERENCES EPerson(eperson_id),
|
||||
|
||||
-- Answers to questions on first page of submit UI
|
||||
multiple_titles NUMBER(1),
|
||||
published_before NUMBER(1),
|
||||
multiple_files NUMBER(1)
|
||||
-- Note: stage reached not applicable here - people involved in workflow
|
||||
-- can always jump around submission UI
|
||||
|
||||
);
|
||||
|
||||
-------------------------------------------------------
|
||||
-- TasklistItem table
|
||||
-------------------------------------------------------
|
||||
CREATE TABLE TasklistItem
|
||||
(
|
||||
tasklist_id INTEGER PRIMARY KEY,
|
||||
eperson_id INTEGER REFERENCES EPerson(eperson_id),
|
||||
workflow_id INTEGER REFERENCES WorkflowItem(workflow_id)
|
||||
);
|
||||
|
||||
|
||||
-------------------------------------------------------
|
||||
-- RegistrationData table
|
||||
-------------------------------------------------------
|
||||
CREATE TABLE RegistrationData
|
||||
(
|
||||
registrationdata_id INTEGER PRIMARY KEY,
|
||||
email VARCHAR2(64) UNIQUE,
|
||||
token VARCHAR2(48),
|
||||
expires TIMESTAMP
|
||||
);
|
||||
|
||||
|
||||
-------------------------------------------------------
|
||||
-- Subscription table
|
||||
-------------------------------------------------------
|
||||
CREATE TABLE Subscription
|
||||
(
|
||||
subscription_id INTEGER PRIMARY KEY,
|
||||
eperson_id INTEGER REFERENCES EPerson(eperson_id),
|
||||
collection_id INTEGER REFERENCES Collection(collection_id)
|
||||
);
|
||||
|
||||
|
||||
-------------------------------------------------------
|
||||
-- History table
|
||||
-------------------------------------------------------
|
||||
CREATE TABLE History
|
||||
(
|
||||
history_id INTEGER PRIMARY KEY,
|
||||
-- When it was stored
|
||||
creation_date TIMESTAMP,
|
||||
-- A checksum to keep INTEGERizations from being stored more than once
|
||||
checksum VARCHAR2(32) UNIQUE
|
||||
);
|
||||
|
||||
-------------------------------------------------------
|
||||
-- HistoryState table
|
||||
-------------------------------------------------------
|
||||
CREATE TABLE HistoryState
|
||||
(
|
||||
history_state_id INTEGER PRIMARY KEY,
|
||||
object_id VARCHAR2(64)
|
||||
);
|
||||
|
||||
------------------------------------------------------------
|
||||
-- Browse subsystem tables and views
|
||||
------------------------------------------------------------
|
||||
|
||||
-------------------------------------------------------
|
||||
-- Communities2Item table
|
||||
-------------------------------------------------------
|
||||
CREATE TABLE Communities2Item
|
||||
(
|
||||
id INTEGER PRIMARY KEY,
|
||||
community_id INTEGER REFERENCES Community(community_id),
|
||||
item_id INTEGER REFERENCES Item(item_id)
|
||||
);
|
||||
|
||||
-------------------------------------------------------
|
||||
-- Community2Item view
|
||||
------------------------------------------------------
|
||||
CREATE VIEW Community2Item as
|
||||
SELECT Community2Collection.community_id, Collection2Item.item_id
|
||||
FROM Community2Collection, Collection2Item
|
||||
WHERE Collection2Item.collection_id = Community2Collection.collection_id
|
||||
;
|
||||
|
||||
-------------------------------------------------------
|
||||
-- ItemsByAuthor table
|
||||
-------------------------------------------------------
|
||||
CREATE TABLE ItemsByAuthor
|
||||
(
|
||||
items_by_author_id INTEGER PRIMARY KEY,
|
||||
item_id INTEGER REFERENCES Item(item_id),
|
||||
author VARCHAR2(2000),
|
||||
sort_author VARCHAR2(2000)
|
||||
);
|
||||
|
||||
-- index by sort_author, of course!
|
||||
CREATE INDEX sort_author_idx on ItemsByAuthor(sort_author);
|
||||
|
||||
-------------------------------------------------------
|
||||
-- CollectionItemsByAuthor view
|
||||
-------------------------------------------------------
|
||||
CREATE VIEW CollectionItemsByAuthor as
|
||||
SELECT Collection2Item.collection_id, ItemsByAuthor.*
|
||||
FROM ItemsByAuthor, Collection2Item
|
||||
WHERE ItemsByAuthor.item_id = Collection2Item.item_id
|
||||
;
|
||||
|
||||
-------------------------------------------------------
|
||||
-- CommunityItemsByAuthor view
|
||||
-------------------------------------------------------
|
||||
CREATE VIEW CommunityItemsByAuthor as
|
||||
SELECT Communities2Item.community_id, ItemsByAuthor.*
|
||||
FROM ItemsByAuthor, Communities2Item
|
||||
WHERE ItemsByAuthor.item_id = Communities2Item.item_id
|
||||
;
|
||||
|
||||
----------------------------------------
|
||||
-- ItemsByTitle table
|
||||
----------------------------------------
|
||||
CREATE TABLE ItemsByTitle
|
||||
(
|
||||
items_by_title_id INTEGER PRIMARY KEY,
|
||||
item_id INTEGER REFERENCES Item(item_id),
|
||||
title VARCHAR2(2000),
|
||||
sort_title VARCHAR2(2000)
|
||||
);
|
||||
|
||||
-- index by the sort_title
|
||||
CREATE INDEX sort_title_idx on ItemsByTitle(sort_title);
|
||||
|
||||
|
||||
-------------------------------------------------------
|
||||
-- CollectionItemsByTitle view
|
||||
-------------------------------------------------------
|
||||
CREATE VIEW CollectionItemsByTitle as
|
||||
SELECT Collection2Item.collection_id, ItemsByTitle.*
|
||||
FROM ItemsByTitle, Collection2Item
|
||||
WHERE ItemsByTitle.item_id = Collection2Item.item_id
|
||||
;
|
||||
|
||||
-------------------------------------------------------
|
||||
-- CommunityItemsByTitle view
|
||||
-------------------------------------------------------
|
||||
CREATE VIEW CommunityItemsByTitle as
|
||||
SELECT Communities2Item.community_id, ItemsByTitle.*
|
||||
FROM ItemsByTitle, Communities2Item
|
||||
WHERE ItemsByTitle.item_id = Communities2Item.item_id
|
||||
;
|
||||
|
||||
-------------------------------------------------------
|
||||
-- ItemsByDate table
|
||||
-------------------------------------------------------
|
||||
CREATE TABLE ItemsByDate
|
||||
(
|
||||
items_by_date_id INTEGER PRIMARY KEY,
|
||||
item_id INTEGER REFERENCES Item(item_id),
|
||||
date_issued VARCHAR2(2000)
|
||||
);
|
||||
|
||||
-- sort by date
|
||||
CREATE INDEX date_issued_idx on ItemsByDate(date_issued);
|
||||
|
||||
-------------------------------------------------------
|
||||
-- CollectionItemsByDate view
|
||||
-------------------------------------------------------
|
||||
CREATE VIEW CollectionItemsByDate as
|
||||
SELECT Collection2Item.collection_id, ItemsByDate.*
|
||||
FROM ItemsByDate, Collection2Item
|
||||
WHERE ItemsByDate.item_id = Collection2Item.item_id
|
||||
;
|
||||
|
||||
-------------------------------------------------------
|
||||
-- CommunityItemsByDate view
|
||||
-------------------------------------------------------
|
||||
CREATE VIEW CommunityItemsByDate as
|
||||
SELECT Communities2Item.community_id, ItemsByDate.*
|
||||
FROM ItemsByDate, Communities2Item
|
||||
WHERE ItemsByDate.item_id = Communities2Item.item_id
|
||||
;
|
||||
|
||||
-------------------------------------------------------
|
||||
-- ItemsByDateAccessioned table
|
||||
-------------------------------------------------------
|
||||
CREATE TABLE ItemsByDateAccessioned
|
||||
(
|
||||
items_by_date_accessioned_id INTEGER PRIMARY KEY,
|
||||
item_id INTEGER REFERENCES Item(item_id),
|
||||
date_accessioned VARCHAR2(2000)
|
||||
);
|
||||
|
||||
-------------------------------------------------------
|
||||
-- CollectionItemsByDateAccession view
|
||||
-------------------------------------------------------
|
||||
CREATE VIEW CollectionItemsByDateAccession as
|
||||
SELECT Collection2Item.collection_id, ItemsByDateAccessioned.*
|
||||
FROM ItemsByDateAccessioned, Collection2Item
|
||||
WHERE ItemsByDateAccessioned.item_id = Collection2Item.item_id
|
||||
;
|
||||
|
||||
-------------------------------------------------------
|
||||
-- CommunityItemsByDateAccession view
|
||||
-------------------------------------------------------
|
||||
CREATE VIEW CommunityItemsByDateAccession as
|
||||
SELECT Communities2Item.community_id, ItemsByDateAccessioned.*
|
||||
FROM ItemsByDateAccessioned, Communities2Item
|
||||
WHERE ItemsByDateAccessioned.item_id = Communities2Item.item_id
|
||||
;
|
@@ -1,57 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-- ===============================================================
|
||||
-- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
||||
--
|
||||
-- DO NOT MANUALLY RUN THIS DATABASE MIGRATION. IT WILL BE EXECUTED
|
||||
-- AUTOMATICALLY (IF NEEDED) BY "FLYWAY" WHEN YOU STARTUP DSPACE.
|
||||
-- http://flywaydb.org/
|
||||
-- ===============================================================
|
||||
|
||||
CREATE SEQUENCE epersongroup2workspaceitem_seq;
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- create the new EPersonGroup2WorkspaceItem table
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
CREATE TABLE EPersonGroup2WorkspaceItem
|
||||
(
|
||||
id INTEGER PRIMARY KEY,
|
||||
eperson_group_id INTEGER REFERENCES EPersonGroup(eperson_group_id),
|
||||
workspace_item_id INTEGER REFERENCES WorkspaceItem(workspace_item_id)
|
||||
);
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- modification to collection table to support being able to change the
|
||||
-- submitter and collection admin group names
|
||||
-------------------------------------------------------------------------------
|
||||
ALTER TABLE collection ADD submitter INTEGER REFERENCES EPersonGroup(eperson_group_id);
|
||||
|
||||
ALTER TABLE collection ADD admin INTEGER REFERENCES EPersonGroup(eperson_group_id);
|
||||
|
||||
ALTER TABLE eperson ADD netid VARCHAR2(64) UNIQUE;
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Additional indices for performance
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
-- index by resource id and resource type id
|
||||
CREATE INDEX handle_resource_id_type_idx ON handle(resource_id, resource_type_id);
|
||||
|
||||
-- Indexing browse tables update/re-index performance
|
||||
CREATE INDEX Communities2Item_item_id_idx ON Communities2Item( item_id );
|
||||
CREATE INDEX ItemsByAuthor_item_id_idx ON ItemsByAuthor(item_id);
|
||||
CREATE INDEX ItemsByTitle_item_id_idx ON ItemsByTitle(item_id);
|
||||
CREATE INDEX ItemsByDate_item_id_idx ON ItemsByDate(item_id);
|
||||
CREATE INDEX ItemsByDateAcc_item_id_idx ON ItemsByDateAccessioned(item_id);
|
||||
|
||||
-- Improve mapping tables
|
||||
CREATE INDEX Com2Coll_community_id_idx ON Community2Collection(community_id);
|
||||
CREATE INDEX Com2Coll_collection_id_idx ON Community2Collection(collection_id);
|
||||
CREATE INDEX Coll2Item_item_id_idx ON Collection2Item( item_id );
|
@@ -1,133 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-- ===============================================================
|
||||
-- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
||||
--
|
||||
-- DO NOT MANUALLY RUN THIS DATABASE MIGRATION. IT WILL BE EXECUTED
|
||||
-- AUTOMATICALLY (IF NEEDED) BY "FLYWAY" WHEN YOU STARTUP DSPACE.
|
||||
-- http://flywaydb.org/
|
||||
-- ===============================================================
|
||||
|
||||
---------------------------------------
|
||||
-- Update MetadataValue to include CLOB
|
||||
---------------------------------------
|
||||
|
||||
CREATE TABLE MetadataValueTemp
|
||||
(
|
||||
metadata_value_id INTEGER PRIMARY KEY,
|
||||
item_id INTEGER REFERENCES Item(item_id),
|
||||
metadata_field_id INTEGER REFERENCES MetadataFieldRegistry(metadata_field_id),
|
||||
text_value CLOB,
|
||||
text_lang VARCHAR(64),
|
||||
place INTEGER
|
||||
);
|
||||
|
||||
INSERT INTO MetadataValueTemp
|
||||
SELECT * FROM MetadataValue;
|
||||
|
||||
DROP VIEW dcvalue;
|
||||
DROP TABLE MetadataValue;
|
||||
ALTER TABLE MetadataValueTemp RENAME TO MetadataValue;
|
||||
|
||||
CREATE VIEW dcvalue AS
|
||||
SELECT MetadataValue.metadata_value_id AS "dc_value_id", MetadataValue.item_id,
|
||||
MetadataValue.metadata_field_id AS "dc_type_id", MetadataValue.text_value,
|
||||
MetadataValue.text_lang, MetadataValue.place
|
||||
FROM MetadataValue, MetadataFieldRegistry
|
||||
WHERE MetadataValue.metadata_field_id = MetadataFieldRegistry.metadata_field_id
|
||||
AND MetadataFieldRegistry.metadata_schema_id = 1;
|
||||
|
||||
CREATE INDEX metadatavalue_item_idx ON MetadataValue(item_id);
|
||||
CREATE INDEX metadatavalue_item_idx2 ON MetadataValue(item_id,metadata_field_id);
|
||||
|
||||
------------------------------------
|
||||
-- Update Community to include CLOBs
|
||||
------------------------------------
|
||||
|
||||
CREATE TABLE CommunityTemp
|
||||
(
|
||||
community_id INTEGER PRIMARY KEY,
|
||||
name VARCHAR2(128),
|
||||
short_description VARCHAR2(512),
|
||||
introductory_text CLOB,
|
||||
logo_bitstream_id INTEGER REFERENCES Bitstream(bitstream_id),
|
||||
copyright_text CLOB,
|
||||
side_bar_text VARCHAR2(2000)
|
||||
);
|
||||
|
||||
INSERT INTO CommunityTemp
|
||||
SELECT * FROM Community;
|
||||
|
||||
DROP TABLE Community CASCADE CONSTRAINTS;
|
||||
ALTER TABLE CommunityTemp RENAME TO Community;
|
||||
|
||||
ALTER TABLE Community2Community ADD CONSTRAINT fk_c2c_parent
|
||||
FOREIGN KEY (parent_comm_id)
|
||||
REFERENCES Community (community_id);
|
||||
|
||||
ALTER TABLE Community2Community ADD CONSTRAINT fk_c2c_child
|
||||
FOREIGN KEY (child_comm_id)
|
||||
REFERENCES Community (community_id);
|
||||
|
||||
ALTER TABLE Community2Collection ADD CONSTRAINT fk_c2c_community
|
||||
FOREIGN KEY (community_id)
|
||||
REFERENCES Community (community_id);
|
||||
|
||||
ALTER TABLE Communities2Item ADD CONSTRAINT fk_c2i_community
|
||||
FOREIGN KEY (community_id)
|
||||
REFERENCES Community (community_id);
|
||||
|
||||
-------------------------------------
|
||||
-- Update Collection to include CLOBs
|
||||
-------------------------------------
|
||||
|
||||
CREATE TABLE CollectionTemp
|
||||
(
|
||||
collection_id INTEGER PRIMARY KEY,
|
||||
name VARCHAR2(128),
|
||||
short_description VARCHAR2(512),
|
||||
introductory_text CLOB,
|
||||
logo_bitstream_id INTEGER REFERENCES Bitstream(bitstream_id),
|
||||
template_item_id INTEGER REFERENCES Item(item_id),
|
||||
provenance_description VARCHAR2(2000),
|
||||
license CLOB,
|
||||
copyright_text CLOB,
|
||||
side_bar_text VARCHAR2(2000),
|
||||
workflow_step_1 INTEGER REFERENCES EPersonGroup( eperson_group_id ),
|
||||
workflow_step_2 INTEGER REFERENCES EPersonGroup( eperson_group_id ),
|
||||
workflow_step_3 INTEGER REFERENCES EPersonGroup( eperson_group_id ),
|
||||
submitter INTEGER REFERENCES EPersonGroup( eperson_group_id ),
|
||||
admin INTEGER REFERENCES EPersonGroup( eperson_group_id )
|
||||
);
|
||||
|
||||
INSERT INTO CollectionTemp
|
||||
SELECT * FROM Collection;
|
||||
|
||||
DROP TABLE Collection CASCADE CONSTRAINTS;
|
||||
ALTER TABLE CollectionTemp RENAME TO Collection;
|
||||
|
||||
ALTER TABLE Community2Collection ADD CONSTRAINT fk_c2c_collection
|
||||
FOREIGN KEY (collection_id)
|
||||
REFERENCES Collection (collection_id);
|
||||
|
||||
ALTER TABLE Collection2Item ADD CONSTRAINT fk_c2i_collection
|
||||
FOREIGN KEY (collection_id)
|
||||
REFERENCES Collection (collection_id);
|
||||
|
||||
ALTER TABLE WorkspaceItem ADD CONSTRAINT fk_wsi_collection
|
||||
FOREIGN KEY (collection_id)
|
||||
REFERENCES Collection (collection_id);
|
||||
|
||||
ALTER TABLE WorkflowItem ADD CONSTRAINT fk_wfi_collection
|
||||
FOREIGN KEY (collection_id)
|
||||
REFERENCES Collection (collection_id);
|
||||
|
||||
ALTER TABLE Subscription ADD CONSTRAINT fk_subs_collection
|
||||
FOREIGN KEY (collection_id)
|
||||
REFERENCES Collection (collection_id);
|
@@ -1,371 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-- ===============================================================
|
||||
-- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
||||
--
|
||||
-- DO NOT MANUALLY RUN THIS DATABASE MIGRATION. IT WILL BE EXECUTED
|
||||
-- AUTOMATICALLY (IF NEEDED) BY "FLYWAY" WHEN YOU STARTUP DSPACE.
|
||||
-- http://flywaydb.org/
|
||||
-- ===============================================================
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Sequences for Group within Group feature
|
||||
-------------------------------------------------------------------------------
|
||||
CREATE SEQUENCE group2group_seq;
|
||||
CREATE SEQUENCE group2groupcache_seq;
|
||||
|
||||
------------------------------------------------------
|
||||
-- Group2Group table, records group membership in other groups
|
||||
------------------------------------------------------
|
||||
CREATE TABLE Group2Group
|
||||
(
|
||||
id INTEGER PRIMARY KEY,
|
||||
parent_id INTEGER REFERENCES EPersonGroup(eperson_group_id),
|
||||
child_id INTEGER REFERENCES EPersonGroup(eperson_group_id)
|
||||
);
|
||||
|
||||
------------------------------------------------------
|
||||
-- Group2GroupCache table, is the 'unwound' hierarchy in
|
||||
-- Group2Group. It explicitly names every parent child
|
||||
-- relationship, even with nested groups. For example,
|
||||
-- If Group2Group lists B is a child of A and C is a child of B,
|
||||
-- this table will have entries for parent(A,B), and parent(B,C)
|
||||
-- AND parent(A,C) so that all of the child groups of A can be
|
||||
-- looked up in a single simple query
|
||||
------------------------------------------------------
|
||||
CREATE TABLE Group2GroupCache
|
||||
(
|
||||
id INTEGER PRIMARY KEY,
|
||||
parent_id INTEGER REFERENCES EPersonGroup(eperson_group_id),
|
||||
child_id INTEGER REFERENCES EPersonGroup(eperson_group_id)
|
||||
);
|
||||
|
||||
|
||||
-------------------------------------------------------
|
||||
-- New Metadata Tables and Sequences
|
||||
-------------------------------------------------------
|
||||
CREATE SEQUENCE metadataschemaregistry_seq;
|
||||
CREATE SEQUENCE metadatafieldregistry_seq;
|
||||
CREATE SEQUENCE metadatavalue_seq;
|
||||
|
||||
-- MetadataSchemaRegistry table
|
||||
CREATE TABLE MetadataSchemaRegistry
|
||||
(
|
||||
metadata_schema_id INTEGER PRIMARY KEY,
|
||||
namespace VARCHAR(256) UNIQUE,
|
||||
short_id VARCHAR(32)
|
||||
);
|
||||
|
||||
-- MetadataFieldRegistry table
|
||||
CREATE TABLE MetadataFieldRegistry
|
||||
(
|
||||
metadata_field_id INTEGER PRIMARY KEY,
|
||||
metadata_schema_id INTEGER NOT NULL REFERENCES MetadataSchemaRegistry(metadata_schema_id),
|
||||
element VARCHAR(64),
|
||||
qualifier VARCHAR(64),
|
||||
scope_note VARCHAR2(2000)
|
||||
);
|
||||
|
||||
-- MetadataValue table
|
||||
CREATE TABLE MetadataValue
|
||||
(
|
||||
metadata_value_id INTEGER PRIMARY KEY,
|
||||
item_id INTEGER REFERENCES Item(item_id),
|
||||
metadata_field_id INTEGER REFERENCES MetadataFieldRegistry(metadata_field_id),
|
||||
text_value VARCHAR2(2000),
|
||||
text_lang VARCHAR(24),
|
||||
place INTEGER
|
||||
);
|
||||
|
||||
-- Create the DC schema
|
||||
INSERT INTO MetadataSchemaRegistry VALUES (1,'http://dublincore.org/documents/dcmi-terms/','dc');
|
||||
|
||||
-- Migrate the existing DCTypes into the new metadata field registry
|
||||
INSERT INTO MetadataFieldRegistry
|
||||
(metadata_schema_id, metadata_field_id, element, qualifier, scope_note)
|
||||
SELECT '1' AS metadata_schema_id, dc_type_id, element,
|
||||
qualifier, scope_note FROM dctyperegistry;
|
||||
|
||||
-- Copy the DCValues into the new MetadataValue table
|
||||
INSERT INTO MetadataValue (item_id, metadata_field_id, text_value, text_lang, place)
|
||||
SELECT item_id, dc_type_id, text_value, text_lang, place FROM dcvalue;
|
||||
|
||||
DROP TABLE dcvalue;
|
||||
CREATE VIEW dcvalue AS
|
||||
SELECT MetadataValue.metadata_value_id AS "dc_value_id", MetadataValue.item_id,
|
||||
MetadataValue.metadata_field_id AS "dc_type_id", MetadataValue.text_value,
|
||||
MetadataValue.text_lang, MetadataValue.place
|
||||
FROM MetadataValue, MetadataFieldRegistry
|
||||
WHERE MetadataValue.metadata_field_id = MetadataFieldRegistry.metadata_field_id
|
||||
AND MetadataFieldRegistry.metadata_schema_id = 1;
|
||||
|
||||
|
||||
-- After copying data from dctypregistry to metadataschemaregistry, we need to reset our sequences
|
||||
-- Update metadatafieldregistry_seq to new max value
|
||||
DECLARE
|
||||
curr NUMBER := 0;
|
||||
BEGIN
|
||||
SELECT max(metadata_field_id) INTO curr FROM metadatafieldregistry;
|
||||
|
||||
curr := curr + 1;
|
||||
|
||||
EXECUTE IMMEDIATE 'DROP SEQUENCE metadatafieldregistry_seq';
|
||||
|
||||
EXECUTE IMMEDIATE 'CREATE SEQUENCE metadatafieldregistry_seq START WITH ' || NVL(curr,1);
|
||||
END;
|
||||
/
|
||||
-- Update metadatavalue_seq to new max value
|
||||
DECLARE
|
||||
curr NUMBER := 0;
|
||||
BEGIN
|
||||
SELECT max(metadata_value_id) INTO curr FROM metadatavalue;
|
||||
|
||||
curr := curr + 1;
|
||||
|
||||
EXECUTE IMMEDIATE 'DROP SEQUENCE metadatavalue_seq';
|
||||
|
||||
EXECUTE IMMEDIATE 'CREATE SEQUENCE metadatavalue_seq START WITH ' || NVL(curr,1);
|
||||
END;
|
||||
/
|
||||
-- Update metadataschemaregistry_seq to new max value
|
||||
DECLARE
|
||||
curr NUMBER := 0;
|
||||
BEGIN
|
||||
SELECT max(metadata_schema_id) INTO curr FROM metadataschemaregistry;
|
||||
|
||||
curr := curr + 1;
|
||||
|
||||
EXECUTE IMMEDIATE 'DROP SEQUENCE metadataschemaregistry_seq';
|
||||
|
||||
EXECUTE IMMEDIATE 'CREATE SEQUENCE metadataschemaregistry_seq START WITH ' || NVL(curr,1);
|
||||
END;
|
||||
/
|
||||
|
||||
-- Drop the old dctyperegistry
|
||||
DROP TABLE dctyperegistry;
|
||||
|
||||
-- create indexes for the metadata tables
|
||||
CREATE INDEX metadatavalue_item_idx ON MetadataValue(item_id);
|
||||
CREATE INDEX metadatavalue_item_idx2 ON MetadataValue(item_id,metadata_field_id);
|
||||
CREATE INDEX metadatafield_schema_idx ON MetadataFieldRegistry(metadata_schema_id);
|
||||
|
||||
|
||||
-------------------------------------------------------
|
||||
-- Create the checksum checker tables
|
||||
-------------------------------------------------------
|
||||
-- list of the possible results as determined
|
||||
-- by the system or an administrator
|
||||
|
||||
CREATE TABLE checksum_results
|
||||
(
|
||||
result_code VARCHAR(64) PRIMARY KEY,
|
||||
result_description VARCHAR2(2000)
|
||||
);
|
||||
|
||||
|
||||
-- This table has a one-to-one relationship
|
||||
-- with the bitstream table. A row will be inserted
|
||||
-- every time a row is inserted into the bitstream table, and
|
||||
-- that row will be updated every time the checksum is
|
||||
-- re-calculated.
|
||||
|
||||
CREATE TABLE most_recent_checksum
|
||||
(
|
||||
bitstream_id INTEGER PRIMARY KEY,
|
||||
to_be_processed NUMBER(1) NOT NULL,
|
||||
expected_checksum VARCHAR(64) NOT NULL,
|
||||
current_checksum VARCHAR(64) NOT NULL,
|
||||
last_process_start_date TIMESTAMP NOT NULL,
|
||||
last_process_end_date TIMESTAMP NOT NULL,
|
||||
checksum_algorithm VARCHAR(64) NOT NULL,
|
||||
matched_prev_checksum NUMBER(1) NOT NULL,
|
||||
result VARCHAR(64) REFERENCES checksum_results(result_code)
|
||||
);
|
||||
|
||||
|
||||
-- A row will be inserted into this table every
|
||||
-- time a checksum is re-calculated.
|
||||
|
||||
CREATE SEQUENCE checksum_history_seq;
|
||||
|
||||
CREATE TABLE checksum_history
|
||||
(
|
||||
check_id INTEGER PRIMARY KEY,
|
||||
bitstream_id INTEGER,
|
||||
process_start_date TIMESTAMP,
|
||||
process_end_date TIMESTAMP,
|
||||
checksum_expected VARCHAR(64),
|
||||
checksum_calculated VARCHAR(64),
|
||||
result VARCHAR(64) REFERENCES checksum_results(result_code)
|
||||
);
|
||||
|
||||
-- this will insert into the result code
|
||||
-- the initial results
|
||||
|
||||
insert into checksum_results
|
||||
values
|
||||
(
|
||||
'INVALID_HISTORY',
|
||||
'Install of the cheksum checking code do not consider this history as valid'
|
||||
);
|
||||
|
||||
insert into checksum_results
|
||||
values
|
||||
(
|
||||
'BITSTREAM_NOT_FOUND',
|
||||
'The bitstream could not be found'
|
||||
);
|
||||
|
||||
insert into checksum_results
|
||||
values
|
||||
(
|
||||
'CHECKSUM_MATCH',
|
||||
'Current checksum matched previous checksum'
|
||||
);
|
||||
|
||||
insert into checksum_results
|
||||
values
|
||||
(
|
||||
'CHECKSUM_NO_MATCH',
|
||||
'Current checksum does not match previous checksum'
|
||||
);
|
||||
|
||||
insert into checksum_results
|
||||
values
|
||||
(
|
||||
'CHECKSUM_PREV_NOT_FOUND',
|
||||
'Previous checksum was not found: no comparison possible'
|
||||
);
|
||||
|
||||
insert into checksum_results
|
||||
values
|
||||
(
|
||||
'BITSTREAM_INFO_NOT_FOUND',
|
||||
'Bitstream info not found'
|
||||
);
|
||||
|
||||
insert into checksum_results
|
||||
values
|
||||
(
|
||||
'CHECKSUM_ALGORITHM_INVALID',
|
||||
'Invalid checksum algorithm'
|
||||
);
|
||||
insert into checksum_results
|
||||
values
|
||||
(
|
||||
'BITSTREAM_NOT_PROCESSED',
|
||||
'Bitstream marked to_be_processed=false'
|
||||
);
|
||||
insert into checksum_results
|
||||
values
|
||||
(
|
||||
'BITSTREAM_MARKED_DELETED',
|
||||
'Bitstream marked deleted in bitstream table'
|
||||
);
|
||||
|
||||
-- this will insert into the most recent checksum
|
||||
-- on install all existing bitstreams
|
||||
-- setting all bitstreams already set as
|
||||
-- deleted to not be processed
|
||||
|
||||
insert into most_recent_checksum
|
||||
(
|
||||
bitstream_id,
|
||||
to_be_processed,
|
||||
expected_checksum,
|
||||
current_checksum,
|
||||
last_process_start_date,
|
||||
last_process_end_date,
|
||||
checksum_algorithm,
|
||||
matched_prev_checksum
|
||||
)
|
||||
select
|
||||
bitstream.bitstream_id,
|
||||
'1',
|
||||
CASE WHEN bitstream.checksum IS NULL THEN '' ELSE bitstream.checksum END,
|
||||
CASE WHEN bitstream.checksum IS NULL THEN '' ELSE bitstream.checksum END,
|
||||
TO_TIMESTAMP(TO_CHAR(current_timestamp, 'DD-MM-RRRR HH24:MI:SS'), 'DD-MM-RRRR HH24:MI:SS'),
|
||||
TO_TIMESTAMP(TO_CHAR(current_timestamp, 'DD-MM-RRRR HH24:MI:SS'), 'DD-MM-RRRR HH24:MI:SS'),
|
||||
CASE WHEN bitstream.checksum_algorithm IS NULL THEN 'MD5' ELSE bitstream.checksum_algorithm END,
|
||||
'1'
|
||||
from bitstream;
|
||||
|
||||
-- Update all the deleted checksums
|
||||
-- to not be checked
|
||||
-- because they have since been
|
||||
-- deleted from the system
|
||||
|
||||
update most_recent_checksum
|
||||
set to_be_processed = 0
|
||||
where most_recent_checksum.bitstream_id in (
|
||||
select bitstream_id
|
||||
from bitstream where deleted = '1' );
|
||||
|
||||
-- this will insert into history table
|
||||
-- for the initial start
|
||||
-- we want to tell the users to disregard the initial
|
||||
-- inserts into the checksum history table
|
||||
|
||||
insert into checksum_history
|
||||
(
|
||||
bitstream_id,
|
||||
process_start_date,
|
||||
process_end_date,
|
||||
checksum_expected,
|
||||
checksum_calculated
|
||||
)
|
||||
select most_recent_checksum.bitstream_id,
|
||||
most_recent_checksum.last_process_end_date,
|
||||
TO_TIMESTAMP(TO_CHAR(current_timestamp, 'DD-MM-RRRR HH24:MI:SS'), 'DD-MM-RRRR HH24:MI:SS'),
|
||||
most_recent_checksum.expected_checksum,
|
||||
most_recent_checksum.expected_checksum
|
||||
FROM most_recent_checksum;
|
||||
|
||||
-- update the history to indicate that this was
|
||||
-- the first time the software was installed
|
||||
update checksum_history
|
||||
set result = 'INVALID_HISTORY';
|
||||
|
||||
|
||||
-------------------------------------------------------
|
||||
-- Table and views for 'browse by subject' functionality
|
||||
-------------------------------------------------------
|
||||
CREATE SEQUENCE itemsbysubject_seq;
|
||||
|
||||
-------------------------------------------------------
|
||||
-- ItemsBySubject table
|
||||
-------------------------------------------------------
|
||||
CREATE TABLE ItemsBySubject
|
||||
(
|
||||
items_by_subject_id INTEGER PRIMARY KEY,
|
||||
item_id INTEGER REFERENCES Item(item_id),
|
||||
subject VARCHAR2(2000),
|
||||
sort_subject VARCHAR2(2000)
|
||||
);
|
||||
|
||||
-- index by sort_subject
|
||||
CREATE INDEX sort_subject_idx on ItemsBySubject(sort_subject);
|
||||
|
||||
-------------------------------------------------------
|
||||
-- CollectionItemsBySubject view
|
||||
-------------------------------------------------------
|
||||
CREATE VIEW CollectionItemsBySubject as
|
||||
SELECT Collection2Item.collection_id, ItemsBySubject.*
|
||||
FROM ItemsBySubject, Collection2Item
|
||||
WHERE ItemsBySubject.item_id = Collection2Item.item_id
|
||||
;
|
||||
|
||||
-------------------------------------------------------
|
||||
-- CommunityItemsBySubject view
|
||||
-------------------------------------------------------
|
||||
CREATE VIEW CommunityItemsBySubject as
|
||||
SELECT Communities2Item.community_id, ItemsBySubject.*
|
||||
FROM ItemsBySubject, Communities2Item
|
||||
WHERE ItemsBySubject.item_id = Communities2Item.item_id
|
||||
;
|
@@ -1,142 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-- ===============================================================
|
||||
-- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
||||
--
|
||||
-- DO NOT MANUALLY RUN THIS DATABASE MIGRATION. IT WILL BE EXECUTED
|
||||
-- AUTOMATICALLY (IF NEEDED) BY "FLYWAY" WHEN YOU STARTUP DSPACE.
|
||||
-- http://flywaydb.org/
|
||||
-- ===============================================================
|
||||
|
||||
-- Remove NOT NULL restrictions from the checksum columns of most_recent_checksum
|
||||
ALTER TABLE most_recent_checksum MODIFY expected_checksum null;
|
||||
ALTER TABLE most_recent_checksum MODIFY current_checksum null;
|
||||
|
||||
------------------------------------------------------
|
||||
-- New Column language language in EPerson
|
||||
------------------------------------------------------
|
||||
|
||||
alter table eperson ADD language VARCHAR2(64);
|
||||
update eperson set language = 'en';
|
||||
|
||||
-- totally unused column
|
||||
alter table bundle drop column mets_bitstream_id;
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Necessary for Configurable Submission functionality:
|
||||
-- Modification to workspaceitem table to support keeping track
|
||||
-- of the last page reached within a step in the Configurable Submission Process
|
||||
-------------------------------------------------------------------------------
|
||||
ALTER TABLE workspaceitem ADD page_reached INTEGER;
|
||||
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
-- Increase the mimetype field size to support larger types, such as the
|
||||
-- new Word 2007 mimetypes.
|
||||
-------------------------------------------------------------------------
|
||||
ALTER TABLE BitstreamFormatRegistry MODIFY (mimetype VARCHAR(256));
|
||||
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
-- Tables to manage cache of item counts for communities and collections
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
CREATE TABLE collection_item_count (
|
||||
collection_id INTEGER PRIMARY KEY REFERENCES collection(collection_id),
|
||||
count INTEGER
|
||||
);
|
||||
|
||||
CREATE TABLE community_item_count (
|
||||
community_id INTEGER PRIMARY KEY REFERENCES community(community_id),
|
||||
count INTEGER
|
||||
);
|
||||
|
||||
------------------------------------------------------------------
|
||||
-- Remove sequences and tables of the old browse system
|
||||
------------------------------------------------------------------
|
||||
|
||||
DROP SEQUENCE itemsbyauthor_seq;
|
||||
DROP SEQUENCE itemsbytitle_seq;
|
||||
DROP SEQUENCE itemsbydate_seq;
|
||||
DROP SEQUENCE itemsbydateaccessioned_seq;
|
||||
DROP SEQUENCE itemsbysubject_seq;
|
||||
|
||||
DROP TABLE ItemsByAuthor CASCADE CONSTRAINTS;
|
||||
DROP TABLE ItemsByTitle CASCADE CONSTRAINTS;
|
||||
DROP TABLE ItemsByDate CASCADE CONSTRAINTS;
|
||||
DROP TABLE ItemsByDateAccessioned CASCADE CONSTRAINTS;
|
||||
DROP TABLE ItemsBySubject CASCADE CONSTRAINTS;
|
||||
|
||||
DROP TABLE History CASCADE CONSTRAINTS;
|
||||
DROP TABLE HistoryState CASCADE CONSTRAINTS;
|
||||
|
||||
----------------------------------------------------------------
|
||||
-- Add indexes for foreign key columns
|
||||
----------------------------------------------------------------
|
||||
|
||||
CREATE INDEX fe_bitstream_fk_idx ON FileExtension(bitstream_format_id);
|
||||
|
||||
CREATE INDEX bit_bitstream_fk_idx ON Bitstream(bitstream_format_id);
|
||||
|
||||
CREATE INDEX g2g_parent_fk_idx ON Group2Group(parent_id);
|
||||
CREATE INDEX g2g_child_fk_idx ON Group2Group(child_id);
|
||||
|
||||
-- CREATE INDEX g2gc_parent_fk_idx ON Group2Group(parent_id);
|
||||
-- CREATE INDEX g2gc_child_fk_idx ON Group2Group(child_id);
|
||||
|
||||
CREATE INDEX item_submitter_fk_idx ON Item(submitter_id);
|
||||
|
||||
CREATE INDEX bundle_primary_fk_idx ON Bundle(primary_bitstream_id);
|
||||
|
||||
CREATE INDEX item2bundle_bundle_fk_idx ON Item2Bundle(bundle_id);
|
||||
|
||||
CREATE INDEX bundle2bits_bitstream_fk_idx ON Bundle2Bitstream(bitstream_id);
|
||||
|
||||
CREATE INDEX metadatavalue_field_fk_idx ON MetadataValue(metadata_field_id);
|
||||
|
||||
CREATE INDEX community_logo_fk_idx ON Community(logo_bitstream_id);
|
||||
|
||||
CREATE INDEX collection_logo_fk_idx ON Collection(logo_bitstream_id);
|
||||
CREATE INDEX collection_template_fk_idx ON Collection(template_item_id);
|
||||
CREATE INDEX collection_workflow1_fk_idx ON Collection(workflow_step_1);
|
||||
CREATE INDEX collection_workflow2_fk_idx ON Collection(workflow_step_2);
|
||||
CREATE INDEX collection_workflow3_fk_idx ON Collection(workflow_step_3);
|
||||
CREATE INDEX collection_submitter_fk_idx ON Collection(submitter);
|
||||
CREATE INDEX collection_admin_fk_idx ON Collection(admin);
|
||||
|
||||
CREATE INDEX com2com_parent_fk_idx ON Community2Community(parent_comm_id);
|
||||
CREATE INDEX com2com_child_fk_idx ON Community2Community(child_comm_id);
|
||||
|
||||
CREATE INDEX rp_eperson_fk_idx ON ResourcePolicy(eperson_id);
|
||||
CREATE INDEX rp_epersongroup_fk_idx ON ResourcePolicy(epersongroup_id);
|
||||
|
||||
CREATE INDEX epg2ep_eperson_fk_idx ON EPersonGroup2EPerson(eperson_id);
|
||||
|
||||
CREATE INDEX workspace_item_fk_idx ON WorkspaceItem(item_id);
|
||||
CREATE INDEX workspace_coll_fk_idx ON WorkspaceItem(collection_id);
|
||||
|
||||
-- CREATE INDEX workflow_item_fk_idx ON WorkflowItem(item_id);
|
||||
CREATE INDEX workflow_coll_fk_idx ON WorkflowItem(collection_id);
|
||||
CREATE INDEX workflow_owner_fk_idx ON WorkflowItem(owner);
|
||||
|
||||
CREATE INDEX tasklist_eperson_fk_idx ON TasklistItem(eperson_id);
|
||||
CREATE INDEX tasklist_workflow_fk_idx ON TasklistItem(workflow_id);
|
||||
|
||||
CREATE INDEX subs_eperson_fk_idx ON Subscription(eperson_id);
|
||||
CREATE INDEX subs_collection_fk_idx ON Subscription(collection_id);
|
||||
|
||||
CREATE INDEX epg2wi_group_fk_idx ON epersongroup2workspaceitem(eperson_group_id);
|
||||
CREATE INDEX epg2wi_workspace_fk_idx ON epersongroup2workspaceitem(workspace_item_id);
|
||||
|
||||
CREATE INDEX Comm2Item_community_fk_idx ON Communities2Item( community_id );
|
||||
|
||||
CREATE INDEX mrc_result_fk_idx ON most_recent_checksum( result );
|
||||
|
||||
CREATE INDEX ch_result_fk_idx ON checksum_history( result );
|
||||
|
@@ -1,93 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-- ===============================================================
|
||||
-- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
||||
--
|
||||
-- DO NOT MANUALLY RUN THIS DATABASE MIGRATION. IT WILL BE EXECUTED
|
||||
-- AUTOMATICALLY (IF NEEDED) BY "FLYWAY" WHEN YOU STARTUP DSPACE.
|
||||
-- http://flywaydb.org/
|
||||
-- ===============================================================
|
||||
|
||||
------------------------------------------------------------------
|
||||
-- New Column for Community Admin - Delegated Admin patch (DS-228)
|
||||
------------------------------------------------------------------
|
||||
ALTER TABLE community ADD admin INTEGER REFERENCES epersongroup ( eperson_group_id );
|
||||
CREATE INDEX community_admin_fk_idx ON Community(admin);
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
-- DS-236 schema changes for Authority Control of Metadata Values
|
||||
-------------------------------------------------------------------------
|
||||
ALTER TABLE MetadataValue
|
||||
ADD ( authority VARCHAR(100),
|
||||
confidence INTEGER DEFAULT -1);
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
-- DS-295 CC License being assigned incorrect Mime Type during submission.
|
||||
--------------------------------------------------------------------------
|
||||
UPDATE bitstream SET bitstream_format_id =
|
||||
(SELECT bitstream_format_id FROM bitstreamformatregistry WHERE short_description = 'CC License')
|
||||
WHERE name = 'license_text' AND source = 'org.dspace.license.CreativeCommons';
|
||||
|
||||
UPDATE bitstream SET bitstream_format_id =
|
||||
(SELECT bitstream_format_id FROM bitstreamformatregistry WHERE short_description = 'RDF XML')
|
||||
WHERE name = 'license_rdf' AND source = 'org.dspace.license.CreativeCommons';
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
-- DS-260 Cleanup of Owning collection column for template item created
|
||||
-- with the JSPUI after the collection creation
|
||||
-------------------------------------------------------------------------
|
||||
UPDATE item SET owning_collection = null WHERE item_id IN
|
||||
(SELECT template_item_id FROM collection WHERE template_item_id IS NOT null);
|
||||
|
||||
-- Recreate restraints with a know name and deferrable option!
|
||||
-- (The previous version of these constraints is dropped by org.dspace.storage.rdbms.migration.V1_5_9__Drop_constraint_for_DSpace_1_6_schema)
|
||||
ALTER TABLE community2collection ADD CONSTRAINT comm2coll_collection_fk FOREIGN KEY (collection_id) REFERENCES collection DEFERRABLE;
|
||||
ALTER TABLE community2community ADD CONSTRAINT com2com_child_fk FOREIGN KEY (child_comm_id) REFERENCES community DEFERRABLE;
|
||||
ALTER TABLE collection2item ADD CONSTRAINT coll2item_item_fk FOREIGN KEY (item_id) REFERENCES item DEFERRABLE;
|
||||
|
||||
|
||||
------------------------------------------------------------------
|
||||
-- New tables /sequences for the harvester functionality (DS-289)
|
||||
------------------------------------------------------------------
|
||||
CREATE SEQUENCE harvested_collection_seq;
|
||||
CREATE SEQUENCE harvested_item_seq;
|
||||
|
||||
-------------------------------------------------------
|
||||
-- Create the harvest settings table
|
||||
-------------------------------------------------------
|
||||
-- Values used by the OAIHarvester to harvest a collection
|
||||
-- HarvestInstance is the DAO class for this table
|
||||
|
||||
CREATE TABLE harvested_collection
|
||||
(
|
||||
collection_id INTEGER REFERENCES collection(collection_id) ON DELETE CASCADE,
|
||||
harvest_type INTEGER,
|
||||
oai_source VARCHAR(256),
|
||||
oai_set_id VARCHAR(256),
|
||||
harvest_message VARCHAR2(512),
|
||||
metadata_config_id VARCHAR(256),
|
||||
harvest_status INTEGER,
|
||||
harvest_start_time TIMESTAMP,
|
||||
last_harvested TIMESTAMP,
|
||||
id INTEGER PRIMARY KEY
|
||||
);
|
||||
|
||||
CREATE INDEX harvested_collection_fk_idx ON harvested_collection(collection_id);
|
||||
|
||||
|
||||
CREATE TABLE harvested_item
|
||||
(
|
||||
item_id INTEGER REFERENCES item(item_id) ON DELETE CASCADE,
|
||||
last_harvested TIMESTAMP,
|
||||
oai_id VARCHAR(64),
|
||||
id INTEGER PRIMARY KEY
|
||||
);
|
||||
|
||||
CREATE INDEX harvested_item_fk_idx ON harvested_item(item_id);
|
||||
|
@@ -1,20 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-- ===============================================================
|
||||
-- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
||||
--
|
||||
-- DO NOT MANUALLY RUN THIS DATABASE MIGRATION. IT WILL BE EXECUTED
|
||||
-- AUTOMATICALLY (IF NEEDED) BY "FLYWAY" WHEN YOU STARTUP DSPACE.
|
||||
-- http://flywaydb.org/
|
||||
-- ===============================================================
|
||||
|
||||
------------------------------------------------------------------
|
||||
-- Remove unused / obsolete sequence 'dctyperegistry_seq' (DS-729)
|
||||
------------------------------------------------------------------
|
||||
DROP SEQUENCE dctyperegistry_seq;
|
@@ -1,23 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-- ===============================================================
|
||||
-- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
||||
--
|
||||
-- DO NOT MANUALLY RUN THIS DATABASE MIGRATION. IT WILL BE EXECUTED
|
||||
-- AUTOMATICALLY (IF NEEDED) BY "FLYWAY" WHEN YOU STARTUP DSPACE.
|
||||
-- http://flywaydb.org/
|
||||
-- ===============================================================
|
||||
|
||||
-------------------------------------------
|
||||
-- New column for bitstream order DS-749 --
|
||||
-------------------------------------------
|
||||
ALTER TABLE bundle2bitstream ADD bitstream_order INTEGER;
|
||||
|
||||
--Place the sequence id's in the order
|
||||
UPDATE bundle2bitstream SET bitstream_order=(SELECT sequence_id FROM bitstream WHERE bitstream.bitstream_id=bundle2bitstream.bitstream_id);
|
@@ -1,52 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-- ===============================================================
|
||||
-- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
||||
--
|
||||
-- DO NOT MANUALLY RUN THIS DATABASE MIGRATION. IT WILL BE EXECUTED
|
||||
-- AUTOMATICALLY (IF NEEDED) BY "FLYWAY" WHEN YOU STARTUP DSPACE.
|
||||
-- http://flywaydb.org/
|
||||
-- ===============================================================
|
||||
|
||||
ALTER TABLE resourcepolicy
|
||||
ADD (
|
||||
rpname VARCHAR2(30),
|
||||
rptype VARCHAR2(30),
|
||||
rpdescription VARCHAR2(100)
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE item ADD discoverable NUMBER(1);
|
||||
|
||||
CREATE TABLE versionhistory
|
||||
(
|
||||
versionhistory_id INTEGER NOT NULL PRIMARY KEY
|
||||
);
|
||||
|
||||
CREATE TABLE versionitem
|
||||
(
|
||||
versionitem_id INTEGER NOT NULL PRIMARY KEY,
|
||||
item_id INTEGER REFERENCES Item(item_id),
|
||||
version_number INTEGER,
|
||||
eperson_id INTEGER REFERENCES EPerson(eperson_id),
|
||||
version_date TIMESTAMP,
|
||||
version_summary VARCHAR2(255),
|
||||
versionhistory_id INTEGER REFERENCES VersionHistory(versionhistory_id)
|
||||
);
|
||||
|
||||
CREATE SEQUENCE versionitem_seq;
|
||||
CREATE SEQUENCE versionhistory_seq;
|
||||
|
||||
|
||||
-------------------------------------------
|
||||
-- New columns and longer hash for salted password hashing DS-861 --
|
||||
-------------------------------------------
|
||||
ALTER TABLE EPerson modify( password VARCHAR(128));
|
||||
ALTER TABLE EPerson ADD salt VARCHAR(32);
|
||||
ALTER TABLE EPerson ADD digest_algorithm VARCHAR(16);
|
@@ -1,88 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-- ===============================================================
|
||||
-- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
||||
--
|
||||
-- DO NOT MANUALLY RUN THIS DATABASE MIGRATION. IT WILL BE EXECUTED
|
||||
-- AUTOMATICALLY (IF NEEDED) BY "FLYWAY" WHEN YOU STARTUP DSPACE.
|
||||
-- http://flywaydb.org/
|
||||
-- ===============================================================
|
||||
|
||||
-------------------------------------------
|
||||
-- Ensure that discoverable has a sensible default
|
||||
-------------------------------------------
|
||||
update item set discoverable=1 WHERE discoverable IS NULL;
|
||||
|
||||
-------------------------------------------
|
||||
-- Add support for DOIs (table and seq.) --
|
||||
-------------------------------------------
|
||||
|
||||
CREATE TABLE Doi
|
||||
(
|
||||
doi_id INTEGER PRIMARY KEY,
|
||||
doi VARCHAR2(256) UNIQUE,
|
||||
resource_type_id INTEGER,
|
||||
resource_id INTEGER,
|
||||
status INTEGER
|
||||
);
|
||||
|
||||
CREATE SEQUENCE doi_seq;
|
||||
|
||||
-- index by resource id and resource type id
|
||||
CREATE INDEX doi_resource_id_type_idx ON doi(resource_id, resource_type_id);
|
||||
|
||||
-------------------------------------------
|
||||
-- Table of running web applications for 'dspace version' --
|
||||
-------------------------------------------
|
||||
|
||||
CREATE TABLE Webapp
|
||||
(
|
||||
webapp_id INTEGER NOT NULL PRIMARY KEY,
|
||||
AppName VARCHAR2(32),
|
||||
URL VARCHAR2(1000),
|
||||
Started TIMESTAMP,
|
||||
isUI NUMBER(1)
|
||||
);
|
||||
|
||||
CREATE SEQUENCE webapp_seq;
|
||||
|
||||
-------------------------------------------------------
|
||||
-- DS-824 RequestItem table
|
||||
-------------------------------------------------------
|
||||
|
||||
CREATE TABLE requestitem
|
||||
(
|
||||
requestitem_id INTEGER NOT NULL,
|
||||
token varchar(48),
|
||||
item_id INTEGER,
|
||||
bitstream_id INTEGER,
|
||||
allfiles NUMBER(1),
|
||||
request_email VARCHAR2(64),
|
||||
request_name VARCHAR2(64),
|
||||
request_date TIMESTAMP,
|
||||
accept_request NUMBER(1),
|
||||
decision_date TIMESTAMP,
|
||||
expires TIMESTAMP,
|
||||
CONSTRAINT requestitem_pkey PRIMARY KEY (requestitem_id),
|
||||
CONSTRAINT requestitem_token_key UNIQUE (token)
|
||||
);
|
||||
|
||||
CREATE SEQUENCE requestitem_seq;
|
||||
|
||||
-------------------------------------------------------
|
||||
-- DS-1655 Disable "Initial Questions" page in Submission UI by default
|
||||
-------------------------------------------------------
|
||||
update workspaceitem set multiple_titles=1, published_before=1, multiple_files=1;
|
||||
update workflowitem set multiple_titles=1, published_before=1, multiple_files=1;
|
||||
|
||||
-------------------------------------------------------
|
||||
-- DS-1811 Removing a collection fails if non-Solr DAO has been used before for item count
|
||||
-------------------------------------------------------
|
||||
delete from collection_item_count;
|
||||
delete from community_item_count;
|
@@ -1,64 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-- ===============================================================
|
||||
-- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
||||
--
|
||||
-- DO NOT MANUALLY RUN THIS DATABASE MIGRATION. IT WILL BE EXECUTED
|
||||
-- AUTOMATICALLY (IF NEEDED) BY "FLYWAY" WHEN YOU STARTUP DSPACE.
|
||||
-- http://flywaydb.org/
|
||||
-- ===============================================================
|
||||
|
||||
-- Special case of migration, we need to the EPerson schema in order to get our metadata for all queries to work
|
||||
-- but we cannot a DB connection until our database is up to date, so we need to create our registries manually in sql
|
||||
|
||||
INSERT INTO metadataschemaregistry (metadata_schema_id, namespace, short_id) SELECT metadataschemaregistry_seq.nextval, 'http://dspace.org/eperson' as namespace, 'eperson' as short_id FROM dual
|
||||
WHERE NOT EXISTS (SELECT metadata_schema_id,namespace,short_id FROM metadataschemaregistry WHERE namespace = 'http://dspace.org/eperson' AND short_id = 'eperson');
|
||||
|
||||
|
||||
-- Insert eperson.firstname
|
||||
INSERT INTO metadatafieldregistry (metadata_field_id, metadata_schema_id, element)
|
||||
SELECT metadatafieldregistry_seq.nextval,
|
||||
(SELECT metadata_schema_id FROM metadataschemaregistry WHERE short_id='eperson'), 'firstname' FROM dual
|
||||
WHERE NOT EXISTS
|
||||
(SELECT metadata_field_id,element FROM metadatafieldregistry WHERE element = 'firstname' AND qualifier IS NULL AND metadata_schema_id = (SELECT metadata_schema_id FROM metadataschemaregistry WHERE short_id='eperson'));
|
||||
|
||||
-- Insert eperson.lastname
|
||||
INSERT INTO metadatafieldregistry (metadata_field_id, metadata_schema_id, element)
|
||||
SELECT metadatafieldregistry_seq.nextval,
|
||||
(SELECT metadata_schema_id FROM metadataschemaregistry WHERE short_id='eperson'), 'lastname' FROM dual
|
||||
WHERE NOT EXISTS
|
||||
(SELECT metadata_field_id,element FROM metadatafieldregistry WHERE element = 'lastname' AND qualifier IS NULL AND metadata_schema_id = (SELECT metadata_schema_id FROM metadataschemaregistry WHERE short_id='eperson'));
|
||||
|
||||
-- Insert eperson.phone
|
||||
INSERT INTO metadatafieldregistry (metadata_field_id, metadata_schema_id, element)
|
||||
SELECT metadatafieldregistry_seq.nextval,
|
||||
(SELECT metadata_schema_id FROM metadataschemaregistry WHERE short_id='eperson'), 'phone' FROM dual
|
||||
WHERE NOT EXISTS
|
||||
(SELECT metadata_field_id,element FROM metadatafieldregistry WHERE element = 'phone' AND qualifier IS NULL AND metadata_schema_id = (SELECT metadata_schema_id FROM metadataschemaregistry WHERE short_id='eperson'));
|
||||
|
||||
-- Insert eperson.language
|
||||
INSERT INTO metadatafieldregistry (metadata_field_id, metadata_schema_id, element)
|
||||
SELECT metadatafieldregistry_seq.nextval,
|
||||
(SELECT metadata_schema_id FROM metadataschemaregistry WHERE short_id='eperson'), 'language' FROM dual
|
||||
WHERE NOT EXISTS
|
||||
(SELECT metadata_field_id,element FROM metadatafieldregistry WHERE element = 'language' AND qualifier IS NULL AND metadata_schema_id = (SELECT metadata_schema_id FROM metadataschemaregistry WHERE short_id='eperson'));
|
||||
|
||||
-- Insert into dc.provenance
|
||||
INSERT INTO metadatafieldregistry (metadata_field_id, metadata_schema_id, element)
|
||||
SELECT metadatafieldregistry_seq.nextval,
|
||||
(SELECT metadata_schema_id FROM metadataschemaregistry WHERE short_id='dc'), 'provenance' FROM dual
|
||||
WHERE NOT EXISTS
|
||||
(SELECT metadata_field_id,element FROM metadatafieldregistry WHERE element = 'provenance' AND qualifier IS NULL AND metadata_schema_id = (SELECT metadata_schema_id FROM metadataschemaregistry WHERE short_id='dc'));
|
||||
|
||||
-- Insert into dc.rights.license
|
||||
INSERT INTO metadatafieldregistry (metadata_field_id, metadata_schema_id, element, qualifier)
|
||||
SELECT metadatafieldregistry_seq.nextval,
|
||||
(SELECT metadata_schema_id FROM metadataschemaregistry WHERE short_id='dc'), 'rights', 'license' FROM dual
|
||||
WHERE NOT EXISTS
|
||||
(SELECT metadata_field_id,element,qualifier FROM metadatafieldregistry WHERE element = 'rights' AND qualifier='license' AND metadata_schema_id = (SELECT metadata_schema_id FROM metadataschemaregistry WHERE short_id='dc'));
|
@@ -1,20 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-- ===============================================================
|
||||
-- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
||||
--
|
||||
-- DO NOT MANUALLY RUN THIS DATABASE MIGRATION. IT WILL BE EXECUTED
|
||||
-- AUTOMATICALLY (IF NEEDED) BY "FLYWAY" WHEN YOU STARTUP DSPACE.
|
||||
-- http://flywaydb.org/
|
||||
-- ===============================================================
|
||||
|
||||
------------------------------------------------------
|
||||
-- DS-1945 RequestItem Helpdesk, store request message
|
||||
------------------------------------------------------
|
||||
ALTER TABLE requestitem ADD request_message VARCHAR2(2000);
|
@@ -1,333 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-- ===============================================================
|
||||
-- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
||||
--
|
||||
-- DO NOT MANUALLY RUN THIS DATABASE MIGRATION. IT WILL BE EXECUTED
|
||||
-- AUTOMATICALLY (IF NEEDED) BY "FLYWAY" WHEN YOU STARTUP DSPACE.
|
||||
-- http://flywaydb.org/
|
||||
-- ===============================================================
|
||||
|
||||
------------------------------------------------------
|
||||
-- DS-1582 Metadata on all DSpace Objects
|
||||
-- NOTE: This script also has a complimentary Flyway Java Migration
|
||||
-- which drops the "item_id" constraint on metadatavalue
|
||||
-- org.dspace.storage.rdbms.migration.V5_0_2014_09_25__DS_1582_Metadata_For_All_Objects_drop_constraint
|
||||
------------------------------------------------------
|
||||
alter table metadatavalue rename column item_id to resource_id;
|
||||
|
||||
alter table metadatavalue MODIFY(resource_id not null);
|
||||
alter table metadatavalue add resource_type_id integer;
|
||||
UPDATE metadatavalue SET resource_type_id = 2;
|
||||
alter table metadatavalue MODIFY(resource_type_id not null);
|
||||
|
||||
|
||||
|
||||
-- ---------
|
||||
-- community
|
||||
-- ---------
|
||||
|
||||
INSERT INTO metadatavalue (metadata_value_id, resource_id, resource_type_id, metadata_field_id, text_value, text_lang, place)
|
||||
SELECT
|
||||
metadatavalue_seq.nextval as metadata_value_id,
|
||||
community_id AS resource_id,
|
||||
4 AS resource_type_id,
|
||||
(select metadata_field_id from metadatafieldregistry where metadata_schema_id=(select metadata_schema_id from metadataschemaregistry where short_id='dc') and element = 'description' and qualifier is null) AS metadata_field_id,
|
||||
introductory_text AS text_value,
|
||||
null AS text_lang,
|
||||
0 AS place
|
||||
FROM community where not introductory_text is null;
|
||||
|
||||
INSERT INTO metadatavalue (metadata_value_id, resource_id, resource_type_id, metadata_field_id, text_value, text_lang, place)
|
||||
SELECT
|
||||
metadatavalue_seq.nextval as metadata_value_id,
|
||||
community_id AS resource_id,
|
||||
4 AS resource_type_id,
|
||||
(select metadata_field_id from metadatafieldregistry where metadata_schema_id=(select metadata_schema_id from metadataschemaregistry where short_id='dc') and element = 'description' and qualifier = 'abstract') AS metadata_field_id,
|
||||
short_description AS text_value,
|
||||
null AS text_lang,
|
||||
0 AS place
|
||||
FROM community where not short_description is null;
|
||||
|
||||
INSERT INTO metadatavalue (metadata_value_id, resource_id, resource_type_id, metadata_field_id, text_value, text_lang, place)
|
||||
SELECT
|
||||
metadatavalue_seq.nextval as metadata_value_id,
|
||||
community_id AS resource_id,
|
||||
4 AS resource_type_id,
|
||||
(select metadata_field_id from metadatafieldregistry where metadata_schema_id=(select metadata_schema_id from metadataschemaregistry where short_id='dc') and element = 'description' and qualifier = 'tableofcontents') AS metadata_field_id,
|
||||
side_bar_text AS text_value,
|
||||
null AS text_lang,
|
||||
0 AS place
|
||||
FROM community where not side_bar_text is null;
|
||||
|
||||
INSERT INTO metadatavalue (metadata_value_id, resource_id, resource_type_id, metadata_field_id, text_value, text_lang, place)
|
||||
SELECT
|
||||
metadatavalue_seq.nextval as metadata_value_id,
|
||||
community_id AS resource_id,
|
||||
4 AS resource_type_id,
|
||||
(select metadata_field_id from metadatafieldregistry where metadata_schema_id=(select metadata_schema_id from metadataschemaregistry where short_id='dc') and element = 'rights' and qualifier is null) AS metadata_field_id,
|
||||
copyright_text AS text_value,
|
||||
null AS text_lang,
|
||||
0 AS place
|
||||
FROM community where not copyright_text is null;
|
||||
|
||||
INSERT INTO metadatavalue (metadata_value_id, resource_id, resource_type_id, metadata_field_id, text_value, text_lang, place)
|
||||
SELECT
|
||||
metadatavalue_seq.nextval as metadata_value_id,
|
||||
community_id AS resource_id,
|
||||
4 AS resource_type_id,
|
||||
(select metadata_field_id from metadatafieldregistry where metadata_schema_id=(select metadata_schema_id from metadataschemaregistry where short_id='dc') and element = 'title' and qualifier is null) AS metadata_field_id,
|
||||
name AS text_value,
|
||||
null AS text_lang,
|
||||
0 AS place
|
||||
FROM community where not name is null;
|
||||
|
||||
alter table community drop (introductory_text, short_description, side_bar_text, copyright_text, name);
|
||||
|
||||
|
||||
-- ----------
|
||||
-- collection
|
||||
-- ----------
|
||||
|
||||
|
||||
|
||||
INSERT INTO metadatavalue (metadata_value_id, resource_id, resource_type_id, metadata_field_id, text_value, text_lang, place)
|
||||
SELECT
|
||||
metadatavalue_seq.nextval as metadata_value_id,
|
||||
collection_id AS resource_id,
|
||||
3 AS resource_type_id,
|
||||
(select metadata_field_id from metadatafieldregistry where metadata_schema_id=(select metadata_schema_id from metadataschemaregistry where short_id='dc') and element = 'description' and qualifier is null) AS metadata_field_id,
|
||||
introductory_text AS text_value,
|
||||
null AS text_lang,
|
||||
0 AS place
|
||||
FROM collection where not introductory_text is null;
|
||||
|
||||
INSERT INTO metadatavalue (metadata_value_id, resource_id, resource_type_id, metadata_field_id, text_value, text_lang, place)
|
||||
SELECT
|
||||
metadatavalue_seq.nextval as metadata_value_id,
|
||||
collection_id AS resource_id,
|
||||
3 AS resource_type_id,
|
||||
(select metadata_field_id from metadatafieldregistry where metadata_schema_id=(select metadata_schema_id from metadataschemaregistry where short_id='dc') and element = 'description' and qualifier = 'abstract') AS metadata_field_id,
|
||||
short_description AS text_value,
|
||||
null AS text_lang,
|
||||
0 AS place
|
||||
FROM collection where not short_description is null;
|
||||
|
||||
INSERT INTO metadatavalue (metadata_value_id, resource_id, resource_type_id, metadata_field_id, text_value, text_lang, place)
|
||||
SELECT
|
||||
metadatavalue_seq.nextval as metadata_value_id,
|
||||
collection_id AS resource_id,
|
||||
3 AS resource_type_id,
|
||||
(select metadata_field_id from metadatafieldregistry where metadata_schema_id=(select metadata_schema_id from metadataschemaregistry where short_id='dc') and element = 'description' and qualifier = 'tableofcontents') AS metadata_field_id,
|
||||
side_bar_text AS text_value,
|
||||
null AS text_lang,
|
||||
0 AS place
|
||||
FROM collection where not side_bar_text is null;
|
||||
|
||||
INSERT INTO metadatavalue (metadata_value_id, resource_id, resource_type_id, metadata_field_id, text_value, text_lang, place)
|
||||
SELECT
|
||||
metadatavalue_seq.nextval as metadata_value_id,
|
||||
collection_id AS resource_id,
|
||||
3 AS resource_type_id,
|
||||
(select metadata_field_id from metadatafieldregistry where metadata_schema_id=(select metadata_schema_id from metadataschemaregistry where short_id='dc') and element = 'rights' and qualifier is null) AS metadata_field_id,
|
||||
copyright_text AS text_value,
|
||||
null AS text_lang,
|
||||
0 AS place
|
||||
FROM collection where not copyright_text is null;
|
||||
|
||||
INSERT INTO metadatavalue (metadata_value_id, resource_id, resource_type_id, metadata_field_id, text_value, text_lang, place)
|
||||
SELECT
|
||||
metadatavalue_seq.nextval as metadata_value_id,
|
||||
collection_id AS resource_id,
|
||||
3 AS resource_type_id,
|
||||
(select metadata_field_id from metadatafieldregistry where metadata_schema_id=(select metadata_schema_id from metadataschemaregistry where short_id='dc') and element = 'title' and qualifier is null) AS metadata_field_id,
|
||||
name AS text_value,
|
||||
null AS text_lang,
|
||||
0 AS place
|
||||
FROM collection where not name is null;
|
||||
|
||||
INSERT INTO metadatavalue (metadata_value_id, resource_id, resource_type_id, metadata_field_id, text_value, text_lang, place)
|
||||
SELECT
|
||||
metadatavalue_seq.nextval as metadata_value_id,
|
||||
collection_id AS resource_id,
|
||||
3 AS resource_type_id,
|
||||
(select metadata_field_id from metadatafieldregistry where metadata_schema_id=(select metadata_schema_id from metadataschemaregistry where short_id='dc') and element = 'provenance' and qualifier is null) AS metadata_field_id,
|
||||
provenance_description AS text_value,
|
||||
null AS text_lang,
|
||||
0 AS place
|
||||
FROM collection where not provenance_description is null;
|
||||
|
||||
INSERT INTO metadatavalue (metadata_value_id, resource_id, resource_type_id, metadata_field_id, text_value, text_lang, place)
|
||||
SELECT
|
||||
metadatavalue_seq.nextval as metadata_value_id,
|
||||
collection_id AS resource_id,
|
||||
3 AS resource_type_id,
|
||||
(select metadata_field_id from metadatafieldregistry where metadata_schema_id=(select metadata_schema_id from metadataschemaregistry where short_id='dc') and element = 'rights' and qualifier = 'license') AS metadata_field_id,
|
||||
license AS text_value,
|
||||
null AS text_lang,
|
||||
0 AS place
|
||||
FROM collection where not license is null;
|
||||
|
||||
alter table collection drop (introductory_text, short_description, copyright_text, side_bar_text, name, license, provenance_description);
|
||||
|
||||
|
||||
-- ---------
|
||||
-- bundle
|
||||
-- ---------
|
||||
|
||||
INSERT INTO metadatavalue (metadata_value_id, resource_id, resource_type_id, metadata_field_id, text_value, text_lang, place)
|
||||
SELECT
|
||||
metadatavalue_seq.nextval as metadata_value_id,
|
||||
bundle_id AS resource_id,
|
||||
1 AS resource_type_id,
|
||||
(select metadata_field_id from metadatafieldregistry where metadata_schema_id=(select metadata_schema_id from metadataschemaregistry where short_id='dc') and element = 'title' and qualifier is null) AS metadata_field_id,
|
||||
name AS text_value,
|
||||
null AS text_lang,
|
||||
0 AS place
|
||||
FROM bundle where not name is null;
|
||||
|
||||
alter table bundle drop column name;
|
||||
|
||||
|
||||
|
||||
-- ---------
|
||||
-- bitstream
|
||||
-- ---------
|
||||
|
||||
|
||||
INSERT INTO metadatavalue (metadata_value_id, resource_id, resource_type_id, metadata_field_id, text_value, text_lang, place)
|
||||
SELECT
|
||||
metadatavalue_seq.nextval as metadata_value_id,
|
||||
bitstream_id AS resource_id,
|
||||
0 AS resource_type_id,
|
||||
(select metadata_field_id from metadatafieldregistry where metadata_schema_id=(select metadata_schema_id from metadataschemaregistry where short_id='dc') and element = 'title' and qualifier is null) AS metadata_field_id,
|
||||
name AS text_value,
|
||||
null AS text_lang,
|
||||
0 AS place
|
||||
FROM bitstream where not name is null;
|
||||
|
||||
INSERT INTO metadatavalue (metadata_value_id, resource_id, resource_type_id, metadata_field_id, text_value, text_lang, place)
|
||||
SELECT
|
||||
metadatavalue_seq.nextval as metadata_value_id,
|
||||
bitstream_id AS resource_id,
|
||||
0 AS resource_type_id,
|
||||
(select metadata_field_id from metadatafieldregistry where metadata_schema_id=(select metadata_schema_id from metadataschemaregistry where short_id='dc') and element = 'description' and qualifier is null) AS metadata_field_id,
|
||||
description AS text_value,
|
||||
null AS text_lang,
|
||||
0 AS place
|
||||
FROM bitstream where not description is null;
|
||||
|
||||
INSERT INTO metadatavalue (metadata_value_id, resource_id, resource_type_id, metadata_field_id, text_value, text_lang, place)
|
||||
SELECT
|
||||
metadatavalue_seq.nextval as metadata_value_id,
|
||||
bitstream_id AS resource_id,
|
||||
0 AS resource_type_id,
|
||||
(select metadata_field_id from metadatafieldregistry where metadata_schema_id=(select metadata_schema_id from metadataschemaregistry where short_id='dc') and element = 'format' and qualifier is null) AS metadata_field_id,
|
||||
user_format_description AS text_value,
|
||||
null AS text_lang,
|
||||
0 AS place
|
||||
FROM bitstream where not user_format_description is null;
|
||||
|
||||
INSERT INTO metadatavalue (metadata_value_id, resource_id, resource_type_id, metadata_field_id, text_value, text_lang, place)
|
||||
SELECT
|
||||
metadatavalue_seq.nextval as metadata_value_id,
|
||||
bitstream_id AS resource_id,
|
||||
0 AS resource_type_id,
|
||||
(select metadata_field_id from metadatafieldregistry where metadata_schema_id=(select metadata_schema_id from metadataschemaregistry where short_id='dc') and element = 'source' and qualifier is null) AS metadata_field_id,
|
||||
source AS text_value,
|
||||
null AS text_lang,
|
||||
0 AS place
|
||||
FROM bitstream where not source is null;
|
||||
|
||||
alter table bitstream drop (name, description, user_format_description, source);
|
||||
|
||||
|
||||
-- ---------
|
||||
-- epersongroup
|
||||
-- ---------
|
||||
|
||||
INSERT INTO metadatavalue (metadata_value_id, resource_id, resource_type_id, metadata_field_id, text_value, text_lang, place)
|
||||
SELECT
|
||||
metadatavalue_seq.nextval as metadata_value_id,
|
||||
eperson_group_id AS resource_id,
|
||||
6 AS resource_type_id,
|
||||
(select metadata_field_id from metadatafieldregistry where metadata_schema_id=(select metadata_schema_id from metadataschemaregistry where short_id='dc') and element = 'title' and qualifier is null) AS metadata_field_id,
|
||||
name AS text_value,
|
||||
null AS text_lang,
|
||||
0 AS place
|
||||
FROM epersongroup where not name is null;
|
||||
|
||||
alter table epersongroup drop column name;
|
||||
|
||||
|
||||
|
||||
-- ---------
|
||||
-- eperson
|
||||
-- ---------
|
||||
|
||||
INSERT INTO metadatavalue (metadata_value_id, resource_id, resource_type_id, metadata_field_id, text_value, text_lang, place)
|
||||
SELECT
|
||||
metadatavalue_seq.nextval as metadata_value_id,
|
||||
eperson_id AS resource_id,
|
||||
7 AS resource_type_id,
|
||||
(select metadata_field_id from metadatafieldregistry where metadata_schema_id=(select metadata_schema_id from metadataschemaregistry where short_id='eperson') and element = 'firstname' and qualifier is null) AS metadata_field_id,
|
||||
firstname AS text_value,
|
||||
null AS text_lang,
|
||||
0 AS place
|
||||
FROM eperson where not firstname is null;
|
||||
|
||||
INSERT INTO metadatavalue (metadata_value_id, resource_id, resource_type_id, metadata_field_id, text_value, text_lang, place)
|
||||
SELECT
|
||||
metadatavalue_seq.nextval as metadata_value_id,
|
||||
eperson_id AS resource_id,
|
||||
7 AS resource_type_id,
|
||||
(select metadata_field_id from metadatafieldregistry where metadata_schema_id=(select metadata_schema_id from metadataschemaregistry where short_id='eperson') and element = 'lastname' and qualifier is null) AS metadata_field_id,
|
||||
lastname AS text_value,
|
||||
null AS text_lang,
|
||||
0 AS place
|
||||
FROM eperson where not lastname is null;
|
||||
|
||||
INSERT INTO metadatavalue (metadata_value_id, resource_id, resource_type_id, metadata_field_id, text_value, text_lang, place)
|
||||
SELECT
|
||||
metadatavalue_seq.nextval as metadata_value_id,
|
||||
eperson_id AS resource_id,
|
||||
7 AS resource_type_id,
|
||||
(select metadata_field_id from metadatafieldregistry where metadata_schema_id=(select metadata_schema_id from metadataschemaregistry where short_id='eperson') and element = 'phone' and qualifier is null) AS metadata_field_id,
|
||||
phone AS text_value,
|
||||
null AS text_lang,
|
||||
0 AS place
|
||||
FROM eperson where not phone is null;
|
||||
|
||||
|
||||
INSERT INTO metadatavalue (metadata_value_id, resource_id, resource_type_id, metadata_field_id, text_value, text_lang, place)
|
||||
SELECT
|
||||
metadatavalue_seq.nextval as metadata_value_id,
|
||||
eperson_id AS resource_id,
|
||||
7 AS resource_type_id,
|
||||
(select metadata_field_id from metadatafieldregistry where metadata_schema_id=(select metadata_schema_id from metadataschemaregistry where short_id='eperson') and element = 'language' and qualifier is null) AS metadata_field_id,
|
||||
language AS text_value,
|
||||
null AS text_lang,
|
||||
0 AS place
|
||||
FROM eperson where not language is null;
|
||||
|
||||
alter table eperson drop (firstname, lastname, phone, language);
|
||||
|
||||
-- ---------
|
||||
-- dcvalue view
|
||||
-- ---------
|
||||
|
||||
drop view dcvalue;
|
||||
|
||||
CREATE VIEW dcvalue AS
|
||||
SELECT MetadataValue.metadata_value_id AS "dc_value_id", MetadataValue.resource_id,
|
||||
MetadataValue.metadata_field_id AS "dc_type_id", MetadataValue.text_value,
|
||||
MetadataValue.text_lang, MetadataValue.place
|
||||
FROM MetadataValue, MetadataFieldRegistry
|
||||
WHERE MetadataValue.metadata_field_id = MetadataFieldRegistry.metadata_field_id
|
||||
AND MetadataFieldRegistry.metadata_schema_id = 1 AND MetadataValue.resource_type_id = 2;
|
@@ -1,24 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
------------------------------------------------------
|
||||
-- DS-3097 introduced new action id for WITHDRAWN_READ
|
||||
------------------------------------------------------
|
||||
|
||||
UPDATE resourcepolicy SET action_id = 12 where action_id = 0 and resource_type_id = 0 and resource_id in (
|
||||
SELECT bundle2bitstream.bitstream_id FROM bundle2bitstream
|
||||
LEFT JOIN item2bundle ON bundle2bitstream.bundle_id = item2bundle.bundle_id
|
||||
LEFT JOIN item ON item2bundle.item_id = item.item_id
|
||||
WHERE item.withdrawn = 1
|
||||
);
|
||||
|
||||
UPDATE resourcepolicy SET action_id = 12 where action_id = 0 and resource_type_id = 1 and resource_id in (
|
||||
SELECT item2bundle.bundle_id FROM item2bundle
|
||||
LEFT JOIN item ON item2bundle.item_id = item.item_id
|
||||
WHERE item.withdrawn = 1
|
||||
);
|
@@ -1,23 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
------------------------------------------------------
|
||||
-- DS-3563 Missing database index on metadatavalue.resource_type_id
|
||||
------------------------------------------------------
|
||||
-- Create an index on the metadata value resource_type_id column so that it can be searched efficiently.
|
||||
declare
|
||||
index_not_exists EXCEPTION;
|
||||
PRAGMA EXCEPTION_INIT(index_not_exists, -1418);
|
||||
begin
|
||||
|
||||
execute immediate 'DROP INDEX metadatavalue_type_id_idx';
|
||||
exception
|
||||
when index_not_exists then null;
|
||||
end;
|
||||
/
|
||||
CREATE INDEX metadatavalue_type_id_idx ON metadatavalue (resource_type_id);
|
@@ -1,469 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
------------------------------------------------------
|
||||
-- DS-2701 Service based API / Hibernate integration
|
||||
------------------------------------------------------
|
||||
DROP VIEW community2item;
|
||||
|
||||
CREATE TABLE dspaceobject
|
||||
(
|
||||
uuid RAW(16) NOT NULL PRIMARY KEY
|
||||
);
|
||||
|
||||
CREATE TABLE site
|
||||
(
|
||||
uuid RAW(16) NOT NULL PRIMARY KEY REFERENCES dspaceobject(uuid)
|
||||
);
|
||||
|
||||
ALTER TABLE eperson ADD uuid RAW(16) DEFAULT SYS_GUID();
|
||||
INSERT INTO dspaceobject (uuid) SELECT uuid FROM eperson;
|
||||
ALTER TABLE eperson ADD FOREIGN KEY (uuid) REFERENCES dspaceobject;
|
||||
ALTER TABLE eperson MODIFY uuid NOT NULL;
|
||||
ALTER TABLE eperson ADD CONSTRAINT eperson_id_unique PRIMARY KEY (uuid);
|
||||
UPDATE eperson SET require_certificate = '0' WHERE require_certificate IS NULL;
|
||||
UPDATE eperson SET self_registered = '0' WHERE self_registered IS NULL;
|
||||
|
||||
|
||||
|
||||
UPDATE metadatavalue SET text_value='Administrator'
|
||||
WHERE resource_type_id=6 AND resource_id=1;
|
||||
UPDATE metadatavalue SET text_value='Anonymous'
|
||||
WHERE resource_type_id=6 AND resource_id=0;
|
||||
|
||||
ALTER TABLE epersongroup ADD uuid RAW(16) DEFAULT SYS_GUID();
|
||||
INSERT INTO dspaceobject (uuid) SELECT uuid FROM epersongroup;
|
||||
ALTER TABLE epersongroup ADD FOREIGN KEY (uuid) REFERENCES dspaceobject;
|
||||
ALTER TABLE epersongroup MODIFY uuid NOT NULL;
|
||||
ALTER TABLE epersongroup ADD CONSTRAINT epersongroup_id_unique PRIMARY KEY (uuid);
|
||||
|
||||
ALTER TABLE item ADD uuid RAW(16) DEFAULT SYS_GUID();
|
||||
INSERT INTO dspaceobject (uuid) SELECT uuid FROM item;
|
||||
ALTER TABLE item ADD FOREIGN KEY (uuid) REFERENCES dspaceobject;
|
||||
ALTER TABLE item MODIFY uuid NOT NULL;
|
||||
ALTER TABLE item ADD CONSTRAINT item_id_unique PRIMARY KEY (uuid);
|
||||
|
||||
ALTER TABLE community ADD uuid RAW(16) DEFAULT SYS_GUID();
|
||||
INSERT INTO dspaceobject (uuid) SELECT uuid FROM community;
|
||||
ALTER TABLE community ADD FOREIGN KEY (uuid) REFERENCES dspaceobject;
|
||||
ALTER TABLE community MODIFY uuid NOT NULL;
|
||||
ALTER TABLE community ADD CONSTRAINT community_id_unique PRIMARY KEY (uuid);
|
||||
|
||||
|
||||
ALTER TABLE collection ADD uuid RAW(16) DEFAULT SYS_GUID();
|
||||
INSERT INTO dspaceobject (uuid) SELECT uuid FROM collection;
|
||||
ALTER TABLE collection ADD FOREIGN KEY (uuid) REFERENCES dspaceobject;
|
||||
ALTER TABLE collection MODIFY uuid NOT NULL;
|
||||
ALTER TABLE collection ADD CONSTRAINT collection_id_unique PRIMARY KEY (uuid);
|
||||
|
||||
ALTER TABLE bundle ADD uuid RAW(16) DEFAULT SYS_GUID();
|
||||
INSERT INTO dspaceobject (uuid) SELECT uuid FROM bundle;
|
||||
ALTER TABLE bundle ADD FOREIGN KEY (uuid) REFERENCES dspaceobject;
|
||||
ALTER TABLE bundle MODIFY uuid NOT NULL;
|
||||
ALTER TABLE bundle ADD CONSTRAINT bundle_id_unique PRIMARY KEY (uuid);
|
||||
|
||||
ALTER TABLE bitstream ADD uuid RAW(16) DEFAULT SYS_GUID();
|
||||
INSERT INTO dspaceobject (uuid) SELECT uuid FROM bitstream;
|
||||
ALTER TABLE bitstream ADD FOREIGN KEY (uuid) REFERENCES dspaceobject;
|
||||
ALTER TABLE bitstream MODIFY uuid NOT NULL;
|
||||
ALTER TABLE bitstream ADD CONSTRAINT bitstream_id_unique PRIMARY KEY (uuid);
|
||||
UPDATE bitstream SET sequence_id = -1 WHERE sequence_id IS NULL;
|
||||
UPDATE bitstream SET size_bytes = -1 WHERE size_bytes IS NULL;
|
||||
UPDATE bitstream SET deleted = '0' WHERE deleted IS NULL;
|
||||
UPDATE bitstream SET store_number = -1 WHERE store_number IS NULL;
|
||||
|
||||
-- Migrate EPersonGroup2EPerson table
|
||||
ALTER TABLE EPersonGroup2EPerson RENAME COLUMN eperson_group_id to eperson_group_legacy_id;
|
||||
ALTER TABLE EPersonGroup2EPerson RENAME COLUMN eperson_id to eperson_legacy_id;
|
||||
ALTER TABLE EPersonGroup2EPerson ADD eperson_group_id RAW(16) REFERENCES EpersonGroup(uuid);
|
||||
ALTER TABLE EPersonGroup2EPerson ADD eperson_id RAW(16) REFERENCES Eperson(uuid);
|
||||
CREATE INDEX EpersonGroup2Eperson_group on EpersonGroup2Eperson(eperson_group_id);
|
||||
CREATE INDEX EpersonGroup2Eperson_person on EpersonGroup2Eperson(eperson_id);
|
||||
UPDATE EPersonGroup2EPerson SET eperson_group_id = (SELECT EPersonGroup.uuid FROM EpersonGroup WHERE EPersonGroup2EPerson.eperson_group_legacy_id = EPersonGroup.eperson_group_id);
|
||||
UPDATE EPersonGroup2EPerson SET eperson_id = (SELECT eperson.uuid FROM eperson WHERE EPersonGroup2EPerson.eperson_legacy_id = eperson.eperson_id);
|
||||
ALTER TABLE EPersonGroup2EPerson MODIFY eperson_group_id NOT NULL;
|
||||
ALTER TABLE EPersonGroup2EPerson MODIFY eperson_id NOT NULL;
|
||||
ALTER TABLE EPersonGroup2EPerson DROP COLUMN eperson_group_legacy_id;
|
||||
ALTER TABLE EPersonGroup2EPerson DROP COLUMN eperson_legacy_id;
|
||||
ALTER TABLE epersongroup2eperson DROP COLUMN id;
|
||||
ALTER TABLE EPersonGroup2EPerson add CONSTRAINT EPersonGroup2EPerson_unique primary key (eperson_group_id,eperson_id);
|
||||
|
||||
-- Migrate GROUP2GROUP table
|
||||
ALTER TABLE Group2Group RENAME COLUMN parent_id to parent_legacy_id;
|
||||
ALTER TABLE Group2Group RENAME COLUMN child_id to child_legacy_id;
|
||||
ALTER TABLE Group2Group ADD parent_id RAW(16) REFERENCES EpersonGroup(uuid);
|
||||
ALTER TABLE Group2Group ADD child_id RAW(16) REFERENCES EpersonGroup(uuid);
|
||||
CREATE INDEX Group2Group_parent on Group2Group(parent_id);
|
||||
CREATE INDEX Group2Group_child on Group2Group(child_id);
|
||||
UPDATE Group2Group SET parent_id = (SELECT EPersonGroup.uuid FROM EpersonGroup WHERE Group2Group.parent_legacy_id = EPersonGroup.eperson_group_id);
|
||||
UPDATE Group2Group SET child_id = (SELECT EpersonGroup.uuid FROM EpersonGroup WHERE Group2Group.child_legacy_id = EpersonGroup.eperson_group_id);
|
||||
ALTER TABLE Group2Group MODIFY parent_id NOT NULL;
|
||||
ALTER TABLE Group2Group MODIFY child_id NOT NULL;
|
||||
ALTER TABLE Group2Group DROP COLUMN parent_legacy_id;
|
||||
ALTER TABLE Group2Group DROP COLUMN child_legacy_id;
|
||||
ALTER TABLE Group2Group DROP COLUMN id;
|
||||
ALTER TABLE Group2Group add CONSTRAINT Group2Group_unique primary key (parent_id,child_id);
|
||||
|
||||
-- Migrate collection2item
|
||||
ALTER TABLE Collection2Item RENAME COLUMN collection_id to collection_legacy_id;
|
||||
ALTER TABLE Collection2Item RENAME COLUMN item_id to item_legacy_id;
|
||||
ALTER TABLE Collection2Item ADD collection_id RAW(16) REFERENCES Collection(uuid);
|
||||
ALTER TABLE Collection2Item ADD item_id RAW(16) REFERENCES Item(uuid);
|
||||
CREATE INDEX Collecion2Item_collection on Collection2Item(collection_id);
|
||||
CREATE INDEX Collecion2Item_item on Collection2Item(item_id);
|
||||
UPDATE Collection2Item SET collection_id = (SELECT Collection.uuid FROM Collection WHERE Collection2Item.collection_legacy_id = Collection.collection_id);
|
||||
UPDATE Collection2Item SET item_id = (SELECT Item.uuid FROM Item WHERE Collection2Item.item_legacy_id = Item.item_id);
|
||||
ALTER TABLE Collection2Item MODIFY collection_id NOT NULL;
|
||||
ALTER TABLE Collection2Item MODIFY item_id NOT NULL;
|
||||
ALTER TABLE Collection2Item DROP COLUMN collection_legacy_id;
|
||||
ALTER TABLE Collection2Item DROP COLUMN item_legacy_id;
|
||||
ALTER TABLE Collection2Item DROP COLUMN id;
|
||||
-- Magic query that will delete all duplicate collection item_id references from the database (if we don't do this the primary key creation will fail)
|
||||
DELETE FROM collection2item WHERE rowid NOT IN (SELECT MIN(rowid) FROM collection2item GROUP BY collection_id,item_id);
|
||||
ALTER TABLE Collection2Item add CONSTRAINT collection2item_unique primary key (collection_id,item_id);
|
||||
|
||||
-- Migrate Community2Community
|
||||
ALTER TABLE Community2Community RENAME COLUMN parent_comm_id to parent_legacy_id;
|
||||
ALTER TABLE Community2Community RENAME COLUMN child_comm_id to child_legacy_id;
|
||||
ALTER TABLE Community2Community ADD parent_comm_id RAW(16) REFERENCES Community(uuid);
|
||||
ALTER TABLE Community2Community ADD child_comm_id RAW(16) REFERENCES Community(uuid);
|
||||
CREATE INDEX Community2Community_parent on Community2Community(parent_comm_id);
|
||||
CREATE INDEX Community2Community_child on Community2Community(child_comm_id);
|
||||
UPDATE Community2Community SET parent_comm_id = (SELECT Community.uuid FROM Community WHERE Community2Community.parent_legacy_id = Community.community_id);
|
||||
UPDATE Community2Community SET child_comm_id = (SELECT Community.uuid FROM Community WHERE Community2Community.child_legacy_id = Community.community_id);
|
||||
ALTER TABLE Community2Community MODIFY parent_comm_id NOT NULL;
|
||||
ALTER TABLE Community2Community MODIFY child_comm_id NOT NULL;
|
||||
ALTER TABLE Community2Community DROP COLUMN parent_legacy_id;
|
||||
ALTER TABLE Community2Community DROP COLUMN child_legacy_id;
|
||||
ALTER TABLE Community2Community DROP COLUMN id;
|
||||
ALTER TABLE Community2Community add CONSTRAINT Community2Community_unique primary key (parent_comm_id,child_comm_id);
|
||||
|
||||
-- Migrate community2collection
|
||||
ALTER TABLE community2collection RENAME COLUMN collection_id to collection_legacy_id;
|
||||
ALTER TABLE community2collection RENAME COLUMN community_id to community_legacy_id;
|
||||
ALTER TABLE community2collection ADD collection_id RAW(16) REFERENCES Collection(uuid);
|
||||
ALTER TABLE community2collection ADD community_id RAW(16) REFERENCES Community(uuid);
|
||||
CREATE INDEX community2collection_collectio on community2collection(collection_id);
|
||||
CREATE INDEX community2collection_community on community2collection(community_id);
|
||||
UPDATE community2collection SET collection_id = (SELECT Collection.uuid FROM Collection WHERE community2collection.collection_legacy_id = Collection.collection_id);
|
||||
UPDATE community2collection SET community_id = (SELECT Community.uuid FROM Community WHERE community2collection.community_legacy_id = Community.community_id);
|
||||
ALTER TABLE community2collection MODIFY collection_id NOT NULL;
|
||||
ALTER TABLE community2collection MODIFY community_id NOT NULL;
|
||||
ALTER TABLE community2collection DROP COLUMN collection_legacy_id;
|
||||
ALTER TABLE community2collection DROP COLUMN community_legacy_id;
|
||||
ALTER TABLE community2collection DROP COLUMN id;
|
||||
ALTER TABLE community2collection add CONSTRAINT community2collection_unique primary key (collection_id,community_id);
|
||||
|
||||
|
||||
-- Migrate Group2GroupCache table
|
||||
ALTER TABLE Group2GroupCache RENAME COLUMN parent_id to parent_legacy_id;
|
||||
ALTER TABLE Group2GroupCache RENAME COLUMN child_id to child_legacy_id;
|
||||
ALTER TABLE Group2GroupCache ADD parent_id RAW(16) REFERENCES EpersonGroup(uuid);
|
||||
ALTER TABLE Group2GroupCache ADD child_id RAW(16) REFERENCES EpersonGroup(uuid);
|
||||
CREATE INDEX Group2GroupCache_parent on Group2GroupCache(parent_id);
|
||||
CREATE INDEX Group2GroupCache_child on Group2GroupCache(child_id);
|
||||
UPDATE Group2GroupCache SET parent_id = (SELECT EPersonGroup.uuid FROM EpersonGroup WHERE Group2GroupCache.parent_legacy_id = EPersonGroup.eperson_group_id);
|
||||
UPDATE Group2GroupCache SET child_id = (SELECT EpersonGroup.uuid FROM EpersonGroup WHERE Group2GroupCache.child_legacy_id = EpersonGroup.eperson_group_id);
|
||||
ALTER TABLE Group2GroupCache MODIFY parent_id NOT NULL;
|
||||
ALTER TABLE Group2GroupCache MODIFY child_id NOT NULL;
|
||||
ALTER TABLE Group2GroupCache DROP COLUMN parent_legacy_id;
|
||||
ALTER TABLE Group2GroupCache DROP COLUMN child_legacy_id;
|
||||
ALTER TABLE Group2GroupCache DROP COLUMN id;
|
||||
ALTER TABLE Group2GroupCache add CONSTRAINT Group2GroupCache_unique primary key (parent_id,child_id);
|
||||
|
||||
-- Migrate Item2Bundle
|
||||
ALTER TABLE item2bundle RENAME COLUMN bundle_id to bundle_legacy_id;
|
||||
ALTER TABLE item2bundle RENAME COLUMN item_id to item_legacy_id;
|
||||
ALTER TABLE item2bundle ADD bundle_id RAW(16) REFERENCES Bundle(uuid);
|
||||
ALTER TABLE item2bundle ADD item_id RAW(16) REFERENCES Item(uuid);
|
||||
CREATE INDEX item2bundle_bundle on item2bundle(bundle_id);
|
||||
CREATE INDEX item2bundle_item on item2bundle(item_id);
|
||||
UPDATE item2bundle SET bundle_id = (SELECT Bundle.uuid FROM Bundle WHERE item2bundle.bundle_legacy_id = Bundle.bundle_id);
|
||||
UPDATE item2bundle SET item_id = (SELECT Item.uuid FROM Item WHERE item2bundle.item_legacy_id = Item.item_id);
|
||||
ALTER TABLE item2bundle MODIFY bundle_id NOT NULL;
|
||||
ALTER TABLE item2bundle MODIFY item_id NOT NULL;
|
||||
ALTER TABLE item2bundle DROP COLUMN bundle_legacy_id;
|
||||
ALTER TABLE item2bundle DROP COLUMN item_legacy_id;
|
||||
ALTER TABLE item2bundle DROP COLUMN id;
|
||||
ALTER TABLE item2bundle add CONSTRAINT item2bundle_unique primary key (bundle_id,item_id);
|
||||
|
||||
--Migrate Bundle2Bitsteam
|
||||
ALTER TABLE bundle2bitstream RENAME COLUMN bundle_id to bundle_legacy_id;
|
||||
ALTER TABLE bundle2bitstream RENAME COLUMN bitstream_id to bitstream_legacy_id;
|
||||
ALTER TABLE bundle2bitstream ADD bundle_id RAW(16) REFERENCES Bundle(uuid);
|
||||
ALTER TABLE bundle2bitstream ADD bitstream_id RAW(16) REFERENCES Bitstream(uuid);
|
||||
CREATE INDEX bundle2bitstream_bundle on bundle2bitstream(bundle_id);
|
||||
CREATE INDEX bundle2bitstream_bitstream on bundle2bitstream(bitstream_id);
|
||||
UPDATE bundle2bitstream SET bundle_id = (SELECT bundle.uuid FROM bundle WHERE bundle2bitstream.bundle_legacy_id = bundle.bundle_id);
|
||||
UPDATE bundle2bitstream SET bitstream_id = (SELECT bitstream.uuid FROM bitstream WHERE bundle2bitstream.bitstream_legacy_id = bitstream.bitstream_id);
|
||||
ALTER TABLE bundle2bitstream RENAME COLUMN bitstream_order to bitstream_order_legacy;
|
||||
ALTER TABLE bundle2bitstream ADD bitstream_order INTEGER;
|
||||
MERGE INTO bundle2bitstream dst
|
||||
USING ( SELECT ROWID AS r_id
|
||||
, ROW_NUMBER () OVER ( PARTITION BY bundle_id
|
||||
ORDER BY bitstream_order_legacy, bitstream_id
|
||||
) AS new_order
|
||||
FROM bundle2bitstream
|
||||
) src
|
||||
ON (dst.ROWID = src.r_id)
|
||||
WHEN MATCHED THEN UPDATE
|
||||
SET dst.bitstream_order = (src.new_order-1)
|
||||
;
|
||||
ALTER TABLE bundle2bitstream MODIFY bundle_id NOT NULL;
|
||||
ALTER TABLE bundle2bitstream MODIFY bitstream_id NOT NULL;
|
||||
ALTER TABLE bundle2bitstream DROP COLUMN bundle_legacy_id;
|
||||
ALTER TABLE bundle2bitstream DROP COLUMN bitstream_legacy_id;
|
||||
ALTER TABLE bundle2bitstream DROP COLUMN id;
|
||||
ALTER TABLE bundle2bitstream add CONSTRAINT bundle2bitstream_unique primary key (bitstream_id,bundle_id,bitstream_order);
|
||||
|
||||
|
||||
-- Migrate item
|
||||
ALTER TABLE item RENAME COLUMN submitter_id to submitter_id_legacy_id;
|
||||
ALTER TABLE item ADD submitter_id RAW(16) REFERENCES EPerson(uuid);
|
||||
CREATE INDEX item_submitter on item(submitter_id);
|
||||
UPDATE item SET submitter_id = (SELECT eperson.uuid FROM eperson WHERE item.submitter_id_legacy_id = eperson.eperson_id);
|
||||
ALTER TABLE item DROP COLUMN submitter_id_legacy_id;
|
||||
|
||||
ALTER TABLE item RENAME COLUMN owning_collection to owning_collection_legacy;
|
||||
ALTER TABLE item ADD owning_collection RAW(16) REFERENCES Collection(uuid);
|
||||
CREATE INDEX item_collection on item(owning_collection);
|
||||
UPDATE item SET owning_collection = (SELECT Collection.uuid FROM Collection WHERE item.owning_collection_legacy = collection.collection_id);
|
||||
ALTER TABLE item DROP COLUMN owning_collection_legacy;
|
||||
|
||||
UPDATE item SET in_archive = '0' WHERE in_archive IS NULL;
|
||||
UPDATE item SET discoverable = '0' WHERE discoverable IS NULL;
|
||||
UPDATE item SET withdrawn = '0' WHERE withdrawn IS NULL;
|
||||
|
||||
-- Migrate bundle
|
||||
ALTER TABLE bundle RENAME COLUMN primary_bitstream_id to primary_bitstream_legacy_id;
|
||||
ALTER TABLE bundle ADD primary_bitstream_id RAW(16) REFERENCES Bitstream(uuid);
|
||||
CREATE INDEX bundle_primary on bundle(primary_bitstream_id);
|
||||
UPDATE bundle SET primary_bitstream_id = (SELECT Bitstream.uuid FROM Bitstream WHERE bundle.primary_bitstream_legacy_id = Bitstream.bitstream_id);
|
||||
ALTER TABLE bundle DROP COLUMN primary_bitstream_legacy_id;
|
||||
|
||||
|
||||
-- Migrate community references
|
||||
ALTER TABLE Community RENAME COLUMN admin to admin_legacy;
|
||||
ALTER TABLE Community ADD admin RAW(16) REFERENCES EPersonGroup(uuid);
|
||||
CREATE INDEX Community_admin on Community(admin);
|
||||
UPDATE Community SET admin = (SELECT EPersonGroup.uuid FROM EPersonGroup WHERE Community.admin_legacy = EPersonGroup.eperson_group_id);
|
||||
ALTER TABLE Community DROP COLUMN admin_legacy;
|
||||
|
||||
ALTER TABLE Community RENAME COLUMN logo_bitstream_id to logo_bitstream_legacy_id;
|
||||
ALTER TABLE Community ADD logo_bitstream_id RAW(16) REFERENCES Bitstream(uuid);
|
||||
CREATE INDEX Community_bitstream on Community(logo_bitstream_id);
|
||||
UPDATE Community SET logo_bitstream_id = (SELECT Bitstream.uuid FROM Bitstream WHERE Community.logo_bitstream_legacy_id = Bitstream.bitstream_id);
|
||||
ALTER TABLE Community DROP COLUMN logo_bitstream_legacy_id;
|
||||
|
||||
|
||||
--Migrate Collection references
|
||||
ALTER TABLE Collection RENAME COLUMN workflow_step_1 to workflow_step_1_legacy;
|
||||
ALTER TABLE Collection RENAME COLUMN workflow_step_2 to workflow_step_2_legacy;
|
||||
ALTER TABLE Collection RENAME COLUMN workflow_step_3 to workflow_step_3_legacy;
|
||||
ALTER TABLE Collection RENAME COLUMN submitter to submitter_legacy;
|
||||
ALTER TABLE Collection RENAME COLUMN template_item_id to template_item_legacy_id;
|
||||
ALTER TABLE Collection RENAME COLUMN logo_bitstream_id to logo_bitstream_legacy_id;
|
||||
ALTER TABLE Collection RENAME COLUMN admin to admin_legacy;
|
||||
ALTER TABLE Collection ADD workflow_step_1 RAW(16) REFERENCES EPersonGroup(uuid);
|
||||
ALTER TABLE Collection ADD workflow_step_2 RAW(16) REFERENCES EPersonGroup(uuid);
|
||||
ALTER TABLE Collection ADD workflow_step_3 RAW(16) REFERENCES EPersonGroup(uuid);
|
||||
ALTER TABLE Collection ADD submitter RAW(16) REFERENCES EPersonGroup(uuid);
|
||||
ALTER TABLE Collection ADD template_item_id RAW(16);
|
||||
ALTER TABLE Collection ADD logo_bitstream_id RAW(16);
|
||||
ALTER TABLE Collection ADD admin RAW(16) REFERENCES EPersonGroup(uuid);
|
||||
CREATE INDEX Collection_workflow1 on Collection(workflow_step_1);
|
||||
CREATE INDEX Collection_workflow2 on Collection(workflow_step_2);
|
||||
CREATE INDEX Collection_workflow3 on Collection(workflow_step_3);
|
||||
CREATE INDEX Collection_submitter on Collection(submitter);
|
||||
CREATE INDEX Collection_template on Collection(template_item_id);
|
||||
CREATE INDEX Collection_bitstream on Collection(logo_bitstream_id);
|
||||
UPDATE Collection SET workflow_step_1 = (SELECT EPersonGroup.uuid FROM EPersonGroup WHERE Collection.workflow_step_1_legacy = EPersonGroup.eperson_group_id);
|
||||
UPDATE Collection SET workflow_step_2 = (SELECT EPersonGroup.uuid FROM EPersonGroup WHERE Collection.workflow_step_2_legacy = EPersonGroup.eperson_group_id);
|
||||
UPDATE Collection SET workflow_step_3 = (SELECT EPersonGroup.uuid FROM EPersonGroup WHERE Collection.workflow_step_3_legacy = EPersonGroup.eperson_group_id);
|
||||
UPDATE Collection SET submitter = (SELECT EPersonGroup.uuid FROM EPersonGroup WHERE Collection.submitter_legacy = EPersonGroup.eperson_group_id);
|
||||
UPDATE Collection SET template_item_id = (SELECT Item.uuid FROM Item WHERE Collection.template_item_legacy_id = Item.item_id);
|
||||
UPDATE Collection SET logo_bitstream_id = (SELECT Bitstream.uuid FROM Bitstream WHERE Collection.logo_bitstream_legacy_id = Bitstream.bitstream_id);
|
||||
UPDATE Collection SET admin = (SELECT EPersonGroup.uuid FROM EPersonGroup WHERE Collection.admin_legacy = EPersonGroup.eperson_group_id);
|
||||
ALTER TABLE Collection DROP COLUMN workflow_step_1_legacy;
|
||||
ALTER TABLE Collection DROP COLUMN workflow_step_2_legacy;
|
||||
ALTER TABLE Collection DROP COLUMN workflow_step_3_legacy;
|
||||
ALTER TABLE Collection DROP COLUMN submitter_legacy;
|
||||
ALTER TABLE Collection DROP COLUMN template_item_legacy_id;
|
||||
ALTER TABLE Collection DROP COLUMN logo_bitstream_legacy_id;
|
||||
ALTER TABLE Collection DROP COLUMN admin_legacy;
|
||||
|
||||
|
||||
-- Migrate resource policy references
|
||||
ALTER TABLE ResourcePolicy RENAME COLUMN eperson_id to eperson_id_legacy_id;
|
||||
ALTER TABLE ResourcePolicy ADD eperson_id RAW(16) REFERENCES EPerson(uuid);
|
||||
CREATE INDEX resourcepolicy_person on resourcepolicy(eperson_id);
|
||||
UPDATE ResourcePolicy SET eperson_id = (SELECT eperson.uuid FROM eperson WHERE ResourcePolicy.eperson_id_legacy_id = eperson.eperson_id);
|
||||
ALTER TABLE ResourcePolicy DROP COLUMN eperson_id_legacy_id;
|
||||
|
||||
ALTER TABLE ResourcePolicy RENAME COLUMN epersongroup_id to epersongroup_id_legacy_id;
|
||||
ALTER TABLE ResourcePolicy ADD epersongroup_id RAW(16) REFERENCES EPersonGroup(uuid);
|
||||
CREATE INDEX resourcepolicy_group on resourcepolicy(epersongroup_id);
|
||||
UPDATE ResourcePolicy SET epersongroup_id = (SELECT epersongroup.uuid FROM epersongroup WHERE ResourcePolicy.epersongroup_id_legacy_id = epersongroup.eperson_group_id);
|
||||
ALTER TABLE ResourcePolicy DROP COLUMN epersongroup_id_legacy_id;
|
||||
|
||||
ALTER TABLE ResourcePolicy ADD dspace_object RAW(16) REFERENCES dspaceobject(uuid);
|
||||
CREATE INDEX resourcepolicy_object on resourcepolicy(dspace_object);
|
||||
UPDATE ResourcePolicy SET dspace_object = (SELECT eperson.uuid FROM eperson WHERE ResourcePolicy.resource_id = eperson.eperson_id AND ResourcePolicy.resource_type_id = 7) WHERE ResourcePolicy.resource_type_id = 7;
|
||||
UPDATE ResourcePolicy SET dspace_object = (SELECT epersongroup.uuid FROM epersongroup WHERE ResourcePolicy.resource_id = epersongroup.eperson_group_id AND ResourcePolicy.resource_type_id = 6) WHERE ResourcePolicy.resource_type_id = 6;
|
||||
UPDATE ResourcePolicy SET dspace_object = (SELECT community.uuid FROM community WHERE ResourcePolicy.resource_id = community.community_id AND ResourcePolicy.resource_type_id = 4) WHERE ResourcePolicy.resource_type_id = 4;
|
||||
UPDATE ResourcePolicy SET dspace_object = (SELECT collection.uuid FROM collection WHERE ResourcePolicy.resource_id = collection.collection_id AND ResourcePolicy.resource_type_id = 3) WHERE ResourcePolicy.resource_type_id = 3;
|
||||
UPDATE ResourcePolicy SET dspace_object = (SELECT item.uuid FROM item WHERE ResourcePolicy.resource_id = item.item_id AND ResourcePolicy.resource_type_id = 2) WHERE ResourcePolicy.resource_type_id = 2;
|
||||
UPDATE ResourcePolicy SET dspace_object = (SELECT bundle.uuid FROM bundle WHERE ResourcePolicy.resource_id = bundle.bundle_id AND ResourcePolicy.resource_type_id = 1) WHERE ResourcePolicy.resource_type_id = 1;
|
||||
UPDATE ResourcePolicy SET dspace_object = (SELECT bitstream.uuid FROM bitstream WHERE ResourcePolicy.resource_id = bitstream.bitstream_id AND ResourcePolicy.resource_type_id = 0) WHERE ResourcePolicy.resource_type_id = 0;
|
||||
UPDATE resourcepolicy SET resource_type_id = -1 WHERE resource_type_id IS NULL;
|
||||
UPDATE resourcepolicy SET action_id = -1 WHERE action_id IS NULL;
|
||||
|
||||
|
||||
-- Migrate Subscription
|
||||
ALTER TABLE Subscription RENAME COLUMN eperson_id to eperson_legacy_id;
|
||||
ALTER TABLE Subscription ADD eperson_id RAW(16) REFERENCES EPerson(uuid);
|
||||
CREATE INDEX Subscription_person on Subscription(eperson_id);
|
||||
UPDATE Subscription SET eperson_id = (SELECT eperson.uuid FROM eperson WHERE Subscription.eperson_legacy_id = eperson.eperson_id);
|
||||
ALTER TABLE Subscription DROP COLUMN eperson_legacy_id;
|
||||
|
||||
ALTER TABLE Subscription RENAME COLUMN collection_id to collection_legacy_id;
|
||||
ALTER TABLE Subscription ADD collection_id RAW(16) REFERENCES Collection(uuid);
|
||||
CREATE INDEX Subscription_collection on Subscription(collection_id);
|
||||
UPDATE Subscription SET collection_id = (SELECT collection.uuid FROM collection WHERE Subscription.collection_legacy_id = collection.collection_id);
|
||||
ALTER TABLE Subscription DROP COLUMN collection_legacy_id;
|
||||
|
||||
|
||||
-- Migrate versionitem
|
||||
ALTER TABLE versionitem RENAME COLUMN eperson_id to eperson_legacy_id;
|
||||
ALTER TABLE versionitem ADD eperson_id RAW(16) REFERENCES EPerson(uuid);
|
||||
CREATE INDEX versionitem_person on versionitem(eperson_id);
|
||||
UPDATE versionitem SET eperson_id = (SELECT eperson.uuid FROM eperson WHERE versionitem.eperson_legacy_id = eperson.eperson_id);
|
||||
ALTER TABLE versionitem DROP COLUMN eperson_legacy_id;
|
||||
|
||||
ALTER TABLE versionitem RENAME COLUMN item_id to item_legacy_id;
|
||||
ALTER TABLE versionitem ADD item_id RAW(16) REFERENCES Item(uuid);
|
||||
CREATE INDEX versionitem_item on versionitem(item_id);
|
||||
UPDATE versionitem SET item_id = (SELECT item.uuid FROM item WHERE versionitem.item_legacy_id = item.item_id);
|
||||
ALTER TABLE versionitem DROP COLUMN item_legacy_id;
|
||||
UPDATE versionitem SET version_number = -1 WHERE version_number IS NULL;
|
||||
|
||||
-- Migrate handle table
|
||||
ALTER TABLE handle RENAME COLUMN resource_id to resource_legacy_id;
|
||||
ALTER TABLE handle ADD resource_id RAW(16) REFERENCES dspaceobject(uuid);
|
||||
CREATE INDEX handle_object on handle(resource_id);
|
||||
UPDATE handle SET resource_id = (SELECT community.uuid FROM community WHERE handle.resource_legacy_id = community.community_id AND handle.resource_type_id = 4);
|
||||
UPDATE handle SET resource_id = (SELECT collection.uuid FROM collection WHERE handle.resource_legacy_id = collection.collection_id AND handle.resource_type_id = 3);
|
||||
UPDATE handle SET resource_id = (SELECT item.uuid FROM item WHERE handle.resource_legacy_id = item.item_id AND handle.resource_type_id = 2);
|
||||
|
||||
-- Migrate metadata value table
|
||||
DROP VIEW dcvalue;
|
||||
|
||||
ALTER TABLE metadatavalue ADD dspace_object_id RAW(16) REFERENCES dspaceobject(uuid);
|
||||
-- CREATE INDEX metadatavalue_field on metadatavalue(metadata_field_id);
|
||||
CREATE INDEX metadatavalue_object on metadatavalue(dspace_object_id);
|
||||
CREATE INDEX metadatavalue_field_object on metadatavalue(metadata_field_id, dspace_object_id);
|
||||
UPDATE metadatavalue SET dspace_object_id = (SELECT eperson.uuid FROM eperson WHERE metadatavalue.resource_id = eperson.eperson_id AND metadatavalue.resource_type_id = 7) WHERE metadatavalue.resource_type_id= 7;
|
||||
UPDATE metadatavalue SET dspace_object_id = (SELECT epersongroup.uuid FROM epersongroup WHERE metadatavalue.resource_id = epersongroup.eperson_group_id AND metadatavalue.resource_type_id = 6) WHERE metadatavalue.resource_type_id= 6;
|
||||
UPDATE metadatavalue SET dspace_object_id = (SELECT community.uuid FROM community WHERE metadatavalue.resource_id = community.community_id AND metadatavalue.resource_type_id = 4) WHERE metadatavalue.resource_type_id= 4;
|
||||
UPDATE metadatavalue SET dspace_object_id = (SELECT collection.uuid FROM collection WHERE metadatavalue.resource_id = collection.collection_id AND metadatavalue.resource_type_id = 3) WHERE metadatavalue.resource_type_id= 3;
|
||||
UPDATE metadatavalue SET dspace_object_id = (SELECT item.uuid FROM item WHERE metadatavalue.resource_id = item.item_id AND metadatavalue.resource_type_id = 2) WHERE metadatavalue.resource_type_id= 2;
|
||||
UPDATE metadatavalue SET dspace_object_id = (SELECT bundle.uuid FROM bundle WHERE metadatavalue.resource_id = bundle.bundle_id AND metadatavalue.resource_type_id = 1) WHERE metadatavalue.resource_type_id= 1;
|
||||
UPDATE metadatavalue SET dspace_object_id = (SELECT bitstream.uuid FROM bitstream WHERE metadatavalue.resource_id = bitstream.bitstream_id AND metadatavalue.resource_type_id = 0) WHERE metadatavalue.resource_type_id= 0;
|
||||
DROP INDEX metadatavalue_item_idx;
|
||||
DROP INDEX metadatavalue_item_idx2;
|
||||
ALTER TABLE metadatavalue DROP COLUMN resource_id;
|
||||
ALTER TABLE metadatavalue DROP COLUMN resource_type_id;
|
||||
UPDATE MetadataValue SET confidence = -1 WHERE confidence IS NULL;
|
||||
UPDATE metadatavalue SET place = -1 WHERE place IS NULL;
|
||||
|
||||
-- Alter harvested item
|
||||
ALTER TABLE harvested_item RENAME COLUMN item_id to item_legacy_id;
|
||||
ALTER TABLE harvested_item ADD item_id RAW(16) REFERENCES item(uuid);
|
||||
CREATE INDEX harvested_item_item on harvested_item(item_id);
|
||||
UPDATE harvested_item SET item_id = (SELECT item.uuid FROM item WHERE harvested_item.item_legacy_id = item.item_id);
|
||||
ALTER TABLE harvested_item DROP COLUMN item_legacy_id;
|
||||
|
||||
-- Alter harvested collection
|
||||
ALTER TABLE harvested_collection RENAME COLUMN collection_id to collection_legacy_id;
|
||||
ALTER TABLE harvested_collection ADD collection_id RAW(16) REFERENCES Collection(uuid);
|
||||
CREATE INDEX harvested_collection_collectio on harvested_collection(collection_id);
|
||||
UPDATE harvested_collection SET collection_id = (SELECT collection.uuid FROM collection WHERE harvested_collection.collection_legacy_id = collection.collection_id);
|
||||
ALTER TABLE harvested_collection DROP COLUMN collection_legacy_id;
|
||||
|
||||
UPDATE harvested_collection SET harvest_type = -1 WHERE harvest_type IS NULL;
|
||||
UPDATE harvested_collection SET harvest_status = -1 WHERE harvest_status IS NULL;
|
||||
|
||||
|
||||
--Alter workspaceitem
|
||||
ALTER TABLE workspaceitem RENAME COLUMN item_id to item_legacy_id;
|
||||
ALTER TABLE workspaceitem ADD item_id RAW(16) REFERENCES Item(uuid);
|
||||
CREATE INDEX workspaceitem_item on workspaceitem(item_id);
|
||||
UPDATE workspaceitem SET item_id = (SELECT item.uuid FROM item WHERE workspaceitem.item_legacy_id = item.item_id);
|
||||
ALTER TABLE workspaceitem DROP COLUMN item_legacy_id;
|
||||
|
||||
ALTER TABLE workspaceitem RENAME COLUMN collection_id to collection_legacy_id;
|
||||
ALTER TABLE workspaceitem ADD collection_id RAW(16) REFERENCES Collection(uuid);
|
||||
CREATE INDEX workspaceitem_coll on workspaceitem(collection_id);
|
||||
UPDATE workspaceitem SET collection_id = (SELECT collection.uuid FROM collection WHERE workspaceitem.collection_legacy_id = collection.collection_id);
|
||||
ALTER TABLE workspaceitem DROP COLUMN collection_legacy_id;
|
||||
|
||||
UPDATE workspaceitem SET multiple_titles = '0' WHERE multiple_titles IS NULL;
|
||||
UPDATE workspaceitem SET published_before = '0' WHERE published_before IS NULL;
|
||||
UPDATE workspaceitem SET multiple_files = '0' WHERE multiple_files IS NULL;
|
||||
UPDATE workspaceitem SET stage_reached = -1 WHERE stage_reached IS NULL;
|
||||
UPDATE workspaceitem SET page_reached = -1 WHERE page_reached IS NULL;
|
||||
|
||||
--Alter epersongroup2workspaceitem
|
||||
ALTER TABLE epersongroup2workspaceitem RENAME COLUMN eperson_group_id to eperson_group_legacy_id;
|
||||
ALTER TABLE epersongroup2workspaceitem ADD eperson_group_id RAW(16) REFERENCES epersongroup(uuid);
|
||||
CREATE INDEX epersongroup2workspaceitem_gro on epersongroup2workspaceitem(eperson_group_id);
|
||||
UPDATE epersongroup2workspaceitem SET eperson_group_id = (SELECT epersongroup.uuid FROM epersongroup WHERE epersongroup2workspaceitem.eperson_group_legacy_id = epersongroup.eperson_group_id);
|
||||
ALTER TABLE epersongroup2workspaceitem DROP COLUMN eperson_group_legacy_id;
|
||||
|
||||
ALTER TABLE epersongroup2workspaceitem DROP COLUMN id;
|
||||
ALTER TABLE epersongroup2workspaceitem MODIFY workspace_item_id NOT NULL;
|
||||
ALTER TABLE epersongroup2workspaceitem MODIFY eperson_group_id NOT NULL;
|
||||
ALTER TABLE epersongroup2workspaceitem add CONSTRAINT epersongroup2wsitem_unqiue primary key (workspace_item_id,eperson_group_id);
|
||||
|
||||
--Alter most_recent_checksum
|
||||
ALTER TABLE most_recent_checksum RENAME COLUMN bitstream_id to bitstream_legacy_id;
|
||||
ALTER TABLE most_recent_checksum ADD bitstream_id RAW(16) REFERENCES Bitstream(uuid);
|
||||
CREATE INDEX most_recent_checksum_bitstream on most_recent_checksum(bitstream_id);
|
||||
UPDATE most_recent_checksum SET bitstream_id = (SELECT Bitstream.uuid FROM Bitstream WHERE most_recent_checksum.bitstream_legacy_id = Bitstream.bitstream_id);
|
||||
ALTER TABLE most_recent_checksum DROP COLUMN bitstream_legacy_id;
|
||||
|
||||
UPDATE most_recent_checksum SET to_be_processed = '0' WHERE to_be_processed IS NULL;
|
||||
UPDATE most_recent_checksum SET matched_prev_checksum = '0' WHERE matched_prev_checksum IS NULL;
|
||||
|
||||
--Alter checksum_history
|
||||
ALTER TABLE checksum_history RENAME COLUMN bitstream_id to bitstream_legacy_id;
|
||||
ALTER TABLE checksum_history ADD bitstream_id RAW(16) REFERENCES Bitstream(uuid);
|
||||
CREATE INDEX checksum_history_bitstream on checksum_history(bitstream_id);
|
||||
UPDATE checksum_history SET bitstream_id = (SELECT Bitstream.uuid FROM Bitstream WHERE checksum_history.bitstream_legacy_id = Bitstream.bitstream_id);
|
||||
ALTER TABLE checksum_history DROP COLUMN bitstream_legacy_id;
|
||||
|
||||
RENAME checksum_history_seq TO checksum_history_check_id_seq;
|
||||
|
||||
--Alter table doi
|
||||
ALTER TABLE doi ADD dspace_object RAW(16) REFERENCES dspaceobject(uuid);
|
||||
CREATE INDEX doi_object on doi(dspace_object);
|
||||
UPDATE doi SET dspace_object = (SELECT community.uuid FROM community WHERE doi.resource_id = community.community_id AND doi.resource_type_id = 4) WHERE doi.resource_type_id = 4;
|
||||
UPDATE doi SET dspace_object = (SELECT collection.uuid FROM collection WHERE doi.resource_id = collection.collection_id AND doi.resource_type_id = 3) WHERE doi.resource_type_id = 3;
|
||||
UPDATE doi SET dspace_object = (SELECT item.uuid FROM item WHERE doi.resource_id = item.item_id AND doi.resource_type_id = 2) WHERE doi.resource_type_id = 2;
|
||||
UPDATE doi SET dspace_object = (SELECT bundle.uuid FROM bundle WHERE doi.resource_id = bundle.bundle_id AND doi.resource_type_id = 1) WHERE doi.resource_type_id = 1;
|
||||
UPDATE doi SET dspace_object = (SELECT bitstream.uuid FROM bitstream WHERE doi.resource_id = bitstream.bitstream_id AND doi.resource_type_id = 0) WHERE doi.resource_type_id = 0;
|
||||
|
||||
--Update table bitstreamformatregistry
|
||||
UPDATE bitstreamformatregistry SET support_level = -1 WHERE support_level IS NULL;
|
||||
|
||||
--Update table requestitem
|
||||
UPDATE requestitem SET allfiles = '0' WHERE allfiles IS NULL;
|
||||
UPDATE requestitem SET accept_request = '0' WHERE accept_request IS NULL;
|
||||
|
||||
--Update table webapp
|
||||
UPDATE webapp SET isui = -1 WHERE isui IS NULL;
|
@@ -1,18 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
------------------------------------------------------
|
||||
-- DS_3378 Lost oracle indexes
|
||||
------------------------------------------------------
|
||||
CREATE UNIQUE INDEX eperson_eperson on eperson(eperson_id);
|
||||
CREATE UNIQUE INDEX epersongroup_eperson_group on epersongroup(eperson_group_id);
|
||||
CREATE UNIQUE INDEX community_community on community(community_id);
|
||||
CREATE UNIQUE INDEX collection_collection on collection(collection_id);
|
||||
CREATE UNIQUE INDEX item_item on item(item_id);
|
||||
CREATE UNIQUE INDEX bundle_bundle on bundle(bundle_id);
|
||||
CREATE UNIQUE INDEX bitstream_bitstream on bitstream(bitstream_id);
|
@@ -1,25 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
------------------------------------------------------
|
||||
-- DS-3024 Invent "permanent" groups
|
||||
------------------------------------------------------
|
||||
|
||||
ALTER TABLE epersongroup
|
||||
ADD (permanent NUMBER(1) DEFAULT 0);
|
||||
UPDATE epersongroup SET permanent = 1
|
||||
WHERE uuid IN (
|
||||
SELECT dspace_object_id
|
||||
FROM metadataschemaregistry s
|
||||
JOIN metadatafieldregistry f USING (metadata_schema_id)
|
||||
JOIN metadatavalue v USING (metadata_field_id)
|
||||
WHERE s.short_id = 'dc'
|
||||
AND f.element = 'title'
|
||||
AND f.qualifier IS NULL
|
||||
AND dbms_lob.compare(v.text_value, 'Administrator') = 0 OR dbms_lob.compare(v.text_value,'Anonymous') = 0
|
||||
);
|
@@ -1,30 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
---------------------------------------------------------------
|
||||
-- DS-3024 extremely slow searching when logged in as admin
|
||||
---------------------------------------------------------------
|
||||
-- This script will put the group name on the epersongroup
|
||||
-- record itself for performance reasons. It will also make
|
||||
-- sure that a group name is unique (so that for example no two
|
||||
-- Administrator groups can be created).
|
||||
---------------------------------------------------------------
|
||||
|
||||
ALTER TABLE epersongroup
|
||||
ADD name VARCHAR2(250);
|
||||
|
||||
CREATE UNIQUE INDEX epersongroup_unique_idx_name on epersongroup(name);
|
||||
|
||||
UPDATE epersongroup
|
||||
SET name =
|
||||
(SELECT text_value
|
||||
FROM metadatavalue v
|
||||
JOIN metadatafieldregistry field on v.metadata_field_id = field.metadata_field_id
|
||||
JOIN metadataschemaregistry s ON field.metadata_schema_id = s.metadata_schema_id
|
||||
WHERE s.short_id = 'dc' AND element = 'title' AND qualifier IS NULL
|
||||
AND v.dspace_object_id = epersongroup.uuid);
|
@@ -1,25 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-- ===============================================================
|
||||
-- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
||||
--
|
||||
-- DO NOT MANUALLY RUN THIS DATABASE MIGRATION. IT WILL BE EXECUTED
|
||||
-- AUTOMATICALLY (IF NEEDED) BY "FLYWAY" WHEN YOU STARTUP DSPACE.
|
||||
-- http://flywaydb.org/
|
||||
-- ===============================================================
|
||||
|
||||
------------------------------------------------------
|
||||
-- DS-1955 resize rpdescription for embargo reason
|
||||
------------------------------------------------------
|
||||
|
||||
-- We cannot alter type between varchar2 & clob directly so an in between column is required
|
||||
ALTER TABLE resourcepolicy ADD rpdescription_clob CLOB;
|
||||
UPDATE resourcepolicy SET rpdescription_clob=rpdescription, rpdescription=null;
|
||||
ALTER TABLE resourcepolicy DROP COLUMN rpdescription;
|
||||
ALTER TABLE resourcepolicy RENAME COLUMN rpdescription_clob TO rpdescription;
|
@@ -1,46 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
---------------------------------------------------------------
|
||||
-- DS-3086 OAI Harvesting performance
|
||||
---------------------------------------------------------------
|
||||
-- This script will create indexes on the key fields of the
|
||||
-- metadataschemaregistry and metadatafieldregistry tables to
|
||||
-- increase the performance of the queries. It will also add
|
||||
-- "ON DELETE CASCADE" to improve the performance of Item deletion.
|
||||
---------------------------------------------------------------
|
||||
|
||||
CREATE UNIQUE INDEX metadataschema_idx_short_id on metadataschemaregistry(short_id);
|
||||
|
||||
CREATE INDEX metadatafield_idx_elem_qual on metadatafieldregistry(element, qualifier);
|
||||
|
||||
CREATE INDEX resourcepolicy_idx_rptype on resourcepolicy(rptype);
|
||||
|
||||
-- Add "ON DELETE CASCADE" to foreign key constraint to Item
|
||||
ALTER TABLE RESOURCEPOLICY ADD DSPACE_OBJECT_NEW RAW(16);
|
||||
UPDATE RESOURCEPOLICY SET DSPACE_OBJECT_NEW = DSPACE_OBJECT;
|
||||
ALTER TABLE RESOURCEPOLICY DROP COLUMN DSPACE_OBJECT;
|
||||
ALTER TABLE RESOURCEPOLICY RENAME COLUMN DSPACE_OBJECT_NEW to DSPACE_OBJECT;
|
||||
|
||||
ALTER TABLE RESOURCEPOLICY
|
||||
ADD CONSTRAINT RESOURCEPOLICY_DSPACE_OBJ_FK
|
||||
FOREIGN KEY (DSPACE_OBJECT)
|
||||
REFERENCES dspaceobject(uuid)
|
||||
ON DELETE CASCADE;
|
||||
|
||||
-- Add "ON DELETE CASCADE" to foreign key constraint to Item
|
||||
ALTER TABLE METADATAVALUE ADD DSPACE_OBJECT_NEW RAW(16);
|
||||
UPDATE METADATAVALUE SET DSPACE_OBJECT_NEW = DSPACE_OBJECT_ID;
|
||||
ALTER TABLE METADATAVALUE DROP COLUMN DSPACE_OBJECT_ID;
|
||||
ALTER TABLE METADATAVALUE RENAME COLUMN DSPACE_OBJECT_NEW to DSPACE_OBJECT_ID;
|
||||
|
||||
ALTER TABLE METADATAVALUE
|
||||
ADD CONSTRAINT METADATAVALUE_DSPACE_OBJECT_FK
|
||||
FOREIGN KEY (DSPACE_OBJECT_ID)
|
||||
REFERENCES DSPACEOBJECT(UUID)
|
||||
ON DELETE CASCADE;
|
@@ -1,33 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
---------------------------------------------------------------
|
||||
-- DS-3125 Submitters cannot delete bistreams of workspaceitems
|
||||
---------------------------------------------------------------
|
||||
-- This script will add delete rights on all bundles/bitstreams
|
||||
-- for people who already have REMOVE rights.
|
||||
-- In previous versions REMOVE rights was enough to ensure that
|
||||
-- you could delete an object.
|
||||
---------------------------------------------------------------
|
||||
INSERT INTO resourcepolicy (policy_id, resource_type_id, resource_id, action_id, start_date, end_date, rpname,
|
||||
rptype, rpdescription, eperson_id, epersongroup_id, dspace_object)
|
||||
SELECT
|
||||
resourcepolicy_seq.nextval AS policy_id,
|
||||
resource_type_id,
|
||||
resource_id,
|
||||
-- Insert the Constants.DELETE action
|
||||
2 AS action_id,
|
||||
start_date,
|
||||
end_date,
|
||||
rpname,
|
||||
rptype,
|
||||
rpdescription,
|
||||
eperson_id,
|
||||
epersongroup_id,
|
||||
dspace_object
|
||||
FROM resourcepolicy WHERE action_id=4 AND (resource_type_id=0 OR resource_type_id=1 OR resource_type_id=2);
|
@@ -1,24 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
---------------------------------------------------------------
|
||||
-- DS-3168 Embargo request Unknown Entity RequestItem
|
||||
---------------------------------------------------------------
|
||||
-- convert the item_id and bitstream_id columns from integer to UUID
|
||||
---------------------------------------------------------------
|
||||
ALTER TABLE requestitem RENAME COLUMN item_id to item_legacy_id;
|
||||
ALTER TABLE requestitem ADD item_id RAW(16) REFERENCES Item(uuid);
|
||||
CREATE INDEX requestitem_item on requestitem(item_id);
|
||||
UPDATE requestitem SET item_id = (SELECT item.uuid FROM item WHERE requestitem.item_legacy_id = item.item_id);
|
||||
ALTER TABLE requestitem DROP COLUMN item_legacy_id;
|
||||
|
||||
ALTER TABLE requestitem RENAME COLUMN bitstream_id to bitstream_legacy_id;
|
||||
ALTER TABLE requestitem ADD bitstream_id RAW(16) REFERENCES Bitstream(uuid);
|
||||
CREATE INDEX requestitem_bitstream on requestitem(bitstream_id);
|
||||
UPDATE requestitem SET bitstream_id = (SELECT Bitstream.uuid FROM Bitstream WHERE requestitem.bitstream_legacy_id = Bitstream.bitstream_id);
|
||||
ALTER TABLE requestitem DROP COLUMN bitstream_legacy_id;
|
@@ -1,30 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
------------------------------------------------------
|
||||
-- DS-2775 Drop unused sequences
|
||||
------------------------------------------------------
|
||||
|
||||
DROP SEQUENCE bitstream_seq;
|
||||
DROP SEQUENCE bundle2bitstream_seq;
|
||||
DROP SEQUENCE bundle_seq;
|
||||
DROP SEQUENCE collection2item_seq;
|
||||
DROP SEQUENCE collection_seq;
|
||||
DROP SEQUENCE community2collection_seq;
|
||||
DROP SEQUENCE community2community_seq;
|
||||
DROP SEQUENCE community_seq;
|
||||
DROP SEQUENCE dcvalue_seq;
|
||||
DROP SEQUENCE eperson_seq;
|
||||
DROP SEQUENCE epersongroup2eperson_seq;
|
||||
DROP SEQUENCE epersongroup2workspaceitem_seq;
|
||||
DROP SEQUENCE epersongroup_seq;
|
||||
DROP SEQUENCE group2group_seq;
|
||||
DROP SEQUENCE group2groupcache_seq;
|
||||
DROP SEQUENCE historystate_seq;
|
||||
DROP SEQUENCE item2bundle_seq;
|
||||
DROP SEQUENCE item_seq;
|
@@ -1,44 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
----------------------------------------------------------------------------------
|
||||
-- DS-3277 : 'handle_id' column needs its own separate sequence, so that Handles
|
||||
-- can be minted from 'handle_seq'
|
||||
----------------------------------------------------------------------------------
|
||||
-- Create a new sequence for 'handle_id' column.
|
||||
-- The role of this sequence is to simply provide a unique internal ID to the database.
|
||||
CREATE SEQUENCE handle_id_seq;
|
||||
-- Initialize new 'handle_id_seq' to the maximum value of 'handle_id'
|
||||
DECLARE
|
||||
curr NUMBER := 0;
|
||||
BEGIN
|
||||
SELECT max(handle_id) INTO curr FROM handle;
|
||||
|
||||
curr := curr + 1;
|
||||
|
||||
EXECUTE IMMEDIATE 'DROP SEQUENCE handle_id_seq';
|
||||
|
||||
EXECUTE IMMEDIATE 'CREATE SEQUENCE handle_id_seq START WITH ' || NVL(curr,1);
|
||||
END;
|
||||
/
|
||||
|
||||
-- Ensure the 'handle_seq' is updated to the maximum *suffix* in 'handle' column,
|
||||
-- as this sequence is used to mint new Handles.
|
||||
-- Code borrowed from update-sequences.sql and updateseq.sql
|
||||
DECLARE
|
||||
curr NUMBER := 0;
|
||||
BEGIN
|
||||
SELECT max(to_number(regexp_replace(handle, '.*/', ''), '999999999999')) INTO curr FROM handle WHERE REGEXP_LIKE(handle, '^.*/[0123456789]*$');
|
||||
|
||||
curr := curr + 1;
|
||||
|
||||
EXECUTE IMMEDIATE 'DROP SEQUENCE handle_seq';
|
||||
|
||||
EXECUTE IMMEDIATE 'CREATE SEQUENCE handle_seq START WITH ' || NVL(curr,1);
|
||||
END;
|
||||
/
|
@@ -1,24 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
------------------------------------------------------
|
||||
-- DS-3097 introduced new action id for WITHDRAWN_READ
|
||||
------------------------------------------------------
|
||||
|
||||
UPDATE resourcepolicy SET action_id = 12 where action_id = 0 and dspace_object in (
|
||||
SELECT bundle2bitstream.bitstream_id FROM bundle2bitstream
|
||||
LEFT JOIN item2bundle ON bundle2bitstream.bundle_id = item2bundle.bundle_id
|
||||
LEFT JOIN item ON item2bundle.item_id = item.uuid
|
||||
WHERE item.withdrawn = 1
|
||||
);
|
||||
|
||||
UPDATE resourcepolicy SET action_id = 12 where action_id = 0 and dspace_object in (
|
||||
SELECT item2bundle.bundle_id FROM item2bundle
|
||||
LEFT JOIN item ON item2bundle.item_id = item.uuid
|
||||
WHERE item.withdrawn = 1
|
||||
);
|
@@ -1,17 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
---------------------------------------------------------------
|
||||
-- DS-3410
|
||||
---------------------------------------------------------------
|
||||
-- This script will create lost indexes
|
||||
---------------------------------------------------------------
|
||||
|
||||
CREATE INDEX resourcepolicy_object on resourcepolicy(dspace_object);
|
||||
CREATE INDEX metadatavalue_object on metadatavalue(dspace_object_id);
|
||||
CREATE INDEX metadatavalue_field_object on metadatavalue(metadata_field_id, dspace_object_id);
|
@@ -1,16 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
------------------------------------------------------
|
||||
-- DS-3097 Handle of collections and communities are lost due to bug at V6.0_2015.03.07__DS-2701_Hibernate_migration.sql
|
||||
------------------------------------------------------
|
||||
|
||||
UPDATE handle SET resource_id = (SELECT community.uuid FROM community WHERE handle.resource_legacy_id = community.community_id AND handle.resource_type_id = 4) where handle.resource_type_id = 4;
|
||||
UPDATE handle SET resource_id = (SELECT collection.uuid FROM collection WHERE handle.resource_legacy_id = collection.collection_id AND handle.resource_type_id = 3) where handle.resource_type_id = 3;
|
||||
UPDATE handle SET resource_id = (SELECT item.uuid FROM item WHERE handle.resource_legacy_id = item.item_id AND handle.resource_type_id = 2) where handle.resource_type_id = 2;
|
||||
|
@@ -1,20 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-- ===============================================================
|
||||
-- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
||||
--
|
||||
-- DO NOT MANUALLY RUN THIS DATABASE MIGRATION. IT WILL BE EXECUTED
|
||||
-- AUTOMATICALLY (IF NEEDED) BY "FLYWAY" WHEN YOU STARTUP DSPACE.
|
||||
-- http://flywaydb.org/
|
||||
-- ===============================================================
|
||||
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
-- This adds an extra column to the eperson table where we save a salt for stateless authentication
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
ALTER TABLE eperson ADD session_salt varchar(32);
|
@@ -1,65 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-- ===============================================================
|
||||
-- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
||||
--
|
||||
-- DO NOT MANUALLY RUN THIS DATABASE MIGRATION. IT WILL BE EXECUTED
|
||||
-- AUTOMATICALLY (IF NEEDED) BY "FLYWAY" WHEN YOU STARTUP DSPACE.
|
||||
-- http://flywaydb.org/
|
||||
-- ===============================================================
|
||||
|
||||
-------------------------------------------------------------
|
||||
-- This will create the setup for the dspace 7 entities usage
|
||||
-------------------------------------------------------------
|
||||
CREATE SEQUENCE entity_type_id_seq;
|
||||
CREATE SEQUENCE relationship_type_id_seq;
|
||||
CREATE SEQUENCE relationship_id_seq;
|
||||
|
||||
CREATE TABLE entity_type
|
||||
(
|
||||
id INTEGER NOT NULL PRIMARY KEY,
|
||||
label varchar(32) UNIQUE NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE relationship_type
|
||||
(
|
||||
id INTEGER NOT NULL PRIMARY KEY,
|
||||
left_type INTEGER NOT NULL,
|
||||
right_type INTEGER NOT NULL,
|
||||
left_label varchar(32) NOT NULL,
|
||||
right_label varchar(32) NOT NULL,
|
||||
left_min_cardinality INTEGER,
|
||||
left_max_cardinality INTEGER,
|
||||
right_min_cardinality INTEGER,
|
||||
right_max_cardinality INTEGER,
|
||||
FOREIGN KEY (left_type) REFERENCES entity_type(id),
|
||||
FOREIGN KEY (right_type) REFERENCES entity_type(id),
|
||||
CONSTRAINT u_relationship_type_constraint UNIQUE (left_type, right_type, left_label, right_label)
|
||||
|
||||
);
|
||||
|
||||
CREATE TABLE relationship
|
||||
(
|
||||
id INTEGER NOT NULL PRIMARY KEY,
|
||||
left_id raw(16) NOT NULL REFERENCES item(uuid),
|
||||
type_id INTEGER NOT NULL REFERENCES relationship_type(id),
|
||||
right_id raw(16) NOT NULL REFERENCES item(uuid),
|
||||
left_place INTEGER,
|
||||
right_place INTEGER,
|
||||
CONSTRAINT u_constraint UNIQUE (left_id, type_id, right_id)
|
||||
|
||||
);
|
||||
|
||||
CREATE INDEX entity_type_label_idx ON entity_type(label);
|
||||
CREATE INDEX rl_ty_by_left_type_idx ON relationship_type(left_type);
|
||||
CREATE INDEX rl_ty_by_right_type_idx ON relationship_type(right_type);
|
||||
CREATE INDEX rl_ty_by_left_label_idx ON relationship_type(left_label);
|
||||
CREATE INDEX rl_ty_by_right_label_idx ON relationship_type(right_label);
|
||||
CREATE INDEX relationship_by_left_id_idx ON relationship(left_id);
|
||||
CREATE INDEX relationship_by_right_id_idx ON relationship(right_id);
|
@@ -1,24 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-- ===============================================================
|
||||
-- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
||||
--
|
||||
-- DO NOT MANUALLY RUN THIS DATABASE MIGRATION. IT WILL BE EXECUTED
|
||||
-- AUTOMATICALLY (IF NEEDED) BY "FLYWAY" WHEN YOU STARTUP DSPACE.
|
||||
-- http://flywaydb.org/
|
||||
-- ===============================================================
|
||||
|
||||
----------------------------------------------------------------------------------------------------------------
|
||||
-- This adds TYPE_INHERITED to all old archived items permission due to the change on resource policy management
|
||||
----------------------------------------------------------------------------------------------------------------
|
||||
UPDATE resourcepolicy set rptype = 'TYPE_INHERITED'
|
||||
where resource_type_id = 2 and rptype is null
|
||||
and dspace_object in (
|
||||
select uuid from item where in_archive = 1
|
||||
);
|
@@ -1,17 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
---------------------------------------------------------------
|
||||
-- DS-4239 Migrate the workflow.xml to spring
|
||||
---------------------------------------------------------------
|
||||
-- This script will rename the default workflow "default" name
|
||||
-- to the new "defaultWorkflow" identifier
|
||||
---------------------------------------------------------------
|
||||
|
||||
UPDATE cwf_pooltask SET workflow_id='defaultWorkflow' WHERE workflow_id='default';
|
||||
UPDATE cwf_claimtask SET workflow_id='defaultWorkflow' WHERE workflow_id='default';
|
@@ -1,18 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-----------------------------------------------------------------------------------
|
||||
-- Create columns leftwardValue and rightwardValue in table relationship
|
||||
-- Rename columns left_label and right_label to leftward_type and rightward_type
|
||||
-----------------------------------------------------------------------------------
|
||||
|
||||
ALTER TABLE relationship ADD leftward_value VARCHAR2(50);
|
||||
ALTER TABLE relationship ADD rightward_value VARCHAR2(50);
|
||||
|
||||
ALTER TABLE relationship_type RENAME COLUMN left_label TO leftward_type;
|
||||
ALTER TABLE relationship_type RENAME COLUMN right_label TO rightward_type;
|
@@ -1,14 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-----------------------------------------------------------------------------------
|
||||
-- Create columns copy_left and copy_right for RelationshipType
|
||||
-----------------------------------------------------------------------------------
|
||||
|
||||
ALTER TABLE relationship_type ADD copy_to_left NUMBER(1) DEFAULT 0 NOT NULL;
|
||||
ALTER TABLE relationship_type ADD copy_to_right NUMBER(1) DEFAULT 0 NOT NULL;
|
@@ -1,40 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-- ===============================================================
|
||||
-- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
||||
--
|
||||
-- DO NOT MANUALLY RUN THIS DATABASE MIGRATION. IT WILL BE EXECUTED
|
||||
-- AUTOMATICALLY (IF NEEDED) BY "FLYWAY" WHEN YOU STARTUP DSPACE.
|
||||
-- http://flywaydb.org/
|
||||
-- ===============================================================
|
||||
CREATE SEQUENCE process_id_seq;
|
||||
|
||||
CREATE TABLE process
|
||||
(
|
||||
process_id INTEGER NOT NULL PRIMARY KEY,
|
||||
user_id RAW(16) NOT NULL,
|
||||
start_time TIMESTAMP,
|
||||
finished_time TIMESTAMP,
|
||||
creation_time TIMESTAMP NOT NULL,
|
||||
script VARCHAR(256) NOT NULL,
|
||||
status VARCHAR(32),
|
||||
parameters VARCHAR(512)
|
||||
);
|
||||
|
||||
CREATE TABLE process2bitstream
|
||||
(
|
||||
process_id INTEGER REFERENCES process(process_id),
|
||||
bitstream_id RAW(16) REFERENCES bitstream(uuid),
|
||||
CONSTRAINT PK_process2bitstream PRIMARY KEY (process_id, bitstream_id)
|
||||
);
|
||||
|
||||
CREATE INDEX process_user_id_idx ON process(user_id);
|
||||
CREATE INDEX process_status_idx ON process(status);
|
||||
CREATE INDEX process_name_idx on process(script);
|
||||
CREATE INDEX process_start_time_idx on process(start_time);
|
@@ -1,29 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-- ===============================================================
|
||||
-- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
||||
--
|
||||
-- DO NOT MANUALLY RUN THIS DATABASE MIGRATION. IT WILL BE EXECUTED
|
||||
-- AUTOMATICALLY (IF NEEDED) BY "FLYWAY" WHEN YOU STARTUP DSPACE.
|
||||
-- http://flywaydb.org/
|
||||
-- ===============================================================
|
||||
|
||||
-------------------------------------------------------------
|
||||
-- This will create the setup for the IRUS statistics harvester
|
||||
-------------------------------------------------------------
|
||||
|
||||
CREATE SEQUENCE openurltracker_seq;
|
||||
|
||||
CREATE TABLE openurltracker
|
||||
(
|
||||
tracker_id NUMBER,
|
||||
tracker_url VARCHAR2(1000),
|
||||
uploaddate DATE,
|
||||
CONSTRAINT openurltracker_PK PRIMARY KEY (tracker_id)
|
||||
);
|
@@ -1,17 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-----------------------------------------------------------------------------------
|
||||
-- Drop the 'workflowitem' and 'tasklistitem' tables
|
||||
-----------------------------------------------------------------------------------
|
||||
|
||||
DROP TABLE workflowitem CASCADE CONSTRAINTS;
|
||||
DROP TABLE tasklistitem CASCADE CONSTRAINTS;
|
||||
|
||||
DROP SEQUENCE workflowitem_seq;
|
||||
DROP SEQUENCE tasklistitem_seq;
|
@@ -1,13 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-----------------------------------------------------------------------------------
|
||||
-- Create columns copy_left and copy_right for RelationshipType
|
||||
-----------------------------------------------------------------------------------
|
||||
|
||||
ALTER TABLE relationship_type ADD tilted INTEGER;
|
@@ -1,56 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-- ===============================================================
|
||||
-- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
||||
--
|
||||
-- DO NOT MANUALLY RUN THIS DATABASE MIGRATION. IT WILL BE EXECUTED
|
||||
-- AUTOMATICALLY (IF NEEDED) BY "FLYWAY" WHEN YOU STARTUP DSPACE.
|
||||
-- http://flywaydb.org/
|
||||
-- ===============================================================
|
||||
|
||||
-------------------------------------------------------------------------------------------------------
|
||||
-- Move all 'relationship.type' metadata fields to 'dspace.entity.type'. Remove 'relationship' schema.
|
||||
-------------------------------------------------------------------------------------------------------
|
||||
-- Special case: we need to the 'dspace' schema to already exist. If users don't already have it we must create it
|
||||
-- manually via SQL, as by default it won't be created until database updates are finished.
|
||||
INSERT INTO metadataschemaregistry (metadata_schema_id, namespace, short_id)
|
||||
SELECT metadataschemaregistry_seq.nextval, 'http://dspace.org/dspace' as namespace, 'dspace' as short_id FROM dual
|
||||
WHERE NOT EXISTS
|
||||
(SELECT metadata_schema_id,namespace,short_id FROM metadataschemaregistry
|
||||
WHERE namespace = 'http://dspace.org/dspace' AND short_id = 'dspace');
|
||||
|
||||
|
||||
-- Add 'dspace.entity.type' field to registry (if missing)
|
||||
INSERT INTO metadatafieldregistry (metadata_field_id, metadata_schema_id, element, qualifier)
|
||||
SELECT metadatafieldregistry_seq.nextval,
|
||||
(SELECT metadata_schema_id FROM metadataschemaregistry WHERE short_id='dspace'), 'entity', 'type' FROM dual
|
||||
WHERE NOT EXISTS
|
||||
(SELECT metadata_field_id,element,qualifier FROM metadatafieldregistry
|
||||
WHERE metadata_schema_id = (SELECT metadata_schema_id FROM metadataschemaregistry WHERE short_id='dspace')
|
||||
AND element = 'entitye' AND qualifier='type');
|
||||
|
||||
-- Moves all 'relationship.type' field values to a new 'dspace.entity.type' field
|
||||
UPDATE metadatavalue
|
||||
SET metadata_field_id =
|
||||
(SELECT metadata_field_id FROM metadatafieldregistry
|
||||
WHERE metadata_schema_id = (SELECT metadata_schema_id FROM metadataschemaregistry WHERE short_id='dspace')
|
||||
AND element = 'entity' AND qualifier='type')
|
||||
WHERE metadata_field_id =
|
||||
(SELECT metadata_field_id FROM metadatafieldregistry
|
||||
WHERE metadata_schema_id = (SELECT metadata_schema_id FROM metadataschemaregistry WHERE short_id='relationship')
|
||||
AND element = 'type' AND qualifier is NULL);
|
||||
|
||||
|
||||
-- Delete 'relationship.type' field from registry
|
||||
DELETE FROM metadatafieldregistry
|
||||
WHERE metadata_schema_id = (SELECT metadata_schema_id FROM metadataschemaregistry WHERE short_id = 'relationship')
|
||||
AND element = 'type' AND qualifier is NULL;
|
||||
|
||||
-- Delete 'relationship' schema (which is now empty)
|
||||
DELETE FROM metadataschemaregistry WHERE short_id = 'relationship' AND namespace = 'http://dspace.org/relationship';
|
@@ -1,28 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-- ===============================================================
|
||||
-- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
||||
--
|
||||
-- DO NOT MANUALLY RUN THIS DATABASE MIGRATION. IT WILL BE EXECUTED
|
||||
-- AUTOMATICALLY (IF NEEDED) BY "FLYWAY" WHEN YOU STARTUP DSPACE.
|
||||
-- http://flywaydb.org/
|
||||
-- ===============================================================
|
||||
|
||||
-------------------------------------------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------------------------------
|
||||
UPDATE metadatavalue SET dspace_object_id = (SELECT uuid
|
||||
FROM collection
|
||||
WHERE template_item_id = dspace_object_id)
|
||||
WHERE dspace_object_id IN (SELECT template_item_id
|
||||
FROM Collection)
|
||||
AND metadata_field_id
|
||||
IN (SELECT metadata_field_id
|
||||
FROM metadatafieldregistry mfr LEFT JOIN metadataschemaregistry msr
|
||||
ON mfr.metadata_schema_id = msr.metadata_schema_id
|
||||
WHERE msr.short_id = 'dspace' AND mfr.element = 'entity' AND mfr.qualifier = 'type');
|
@@ -1,15 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-------------------------------------------------------------------------------------
|
||||
---- ALTER table collection
|
||||
-------------------------------------------------------------------------------------
|
||||
|
||||
ALTER TABLE collection DROP COLUMN workflow_step_1;
|
||||
ALTER TABLE collection DROP COLUMN workflow_step_2;
|
||||
ALTER TABLE collection DROP COLUMN workflow_step_3;
|
@@ -1,24 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
----------------------------------------------------
|
||||
-- Make sure the metadatavalue.place column starts at 0 instead of 1
|
||||
----------------------------------------------------
|
||||
MERGE INTO metadatavalue mdv
|
||||
USING (
|
||||
SELECT dspace_object_id, metadata_field_id, MIN(place) AS minplace
|
||||
FROM metadatavalue
|
||||
GROUP BY dspace_object_id, metadata_field_id
|
||||
) mp
|
||||
ON (
|
||||
mdv.dspace_object_id = mp.dspace_object_id
|
||||
AND mdv.metadata_field_id = mp.metadata_field_id
|
||||
AND mp.minplace > 0
|
||||
)
|
||||
WHEN MATCHED THEN UPDATE
|
||||
SET mdv.place = mdv.place - mp.minplace;
|
@@ -1,54 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-----------------------------------------------------------------------------------
|
||||
-- Create tables for ORCID Queue and History
|
||||
-----------------------------------------------------------------------------------
|
||||
|
||||
CREATE SEQUENCE orcid_queue_id_seq;
|
||||
|
||||
CREATE TABLE orcid_queue
|
||||
(
|
||||
id INTEGER NOT NULL,
|
||||
owner_id RAW(16) NOT NULL,
|
||||
entity_id RAW(16),
|
||||
put_code VARCHAR(255),
|
||||
record_type VARCHAR(255),
|
||||
description VARCHAR(255),
|
||||
operation VARCHAR(255),
|
||||
metadata CLOB,
|
||||
attempts INTEGER,
|
||||
CONSTRAINT orcid_queue_pkey PRIMARY KEY (id),
|
||||
CONSTRAINT orcid_queue_owner_id_fkey FOREIGN KEY (owner_id) REFERENCES item (uuid),
|
||||
CONSTRAINT orcid_queue_entity_id_fkey FOREIGN KEY (entity_id) REFERENCES item (uuid)
|
||||
);
|
||||
|
||||
CREATE INDEX orcid_queue_owner_id_index on orcid_queue(owner_id);
|
||||
|
||||
|
||||
CREATE SEQUENCE orcid_history_id_seq;
|
||||
|
||||
CREATE TABLE orcid_history
|
||||
(
|
||||
id INTEGER NOT NULL,
|
||||
owner_id RAW(16) NOT NULL,
|
||||
entity_id RAW(16),
|
||||
put_code VARCHAR(255),
|
||||
timestamp_last_attempt TIMESTAMP,
|
||||
response_message CLOB,
|
||||
status INTEGER,
|
||||
metadata CLOB,
|
||||
operation VARCHAR(255),
|
||||
record_type VARCHAR(255),
|
||||
description VARCHAR(255),
|
||||
CONSTRAINT orcid_history_pkey PRIMARY KEY (id),
|
||||
CONSTRAINT orcid_history_owner_id_fkey FOREIGN KEY (owner_id) REFERENCES item (uuid),
|
||||
CONSTRAINT orcid_history_entity_id_fkey FOREIGN KEY (entity_id) REFERENCES item (uuid)
|
||||
);
|
||||
|
||||
CREATE INDEX orcid_history_owner_id_index on orcid_history(owner_id);
|
@@ -1,24 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-----------------------------------------------------------------------------------
|
||||
-- Create table for ORCID access tokens
|
||||
-----------------------------------------------------------------------------------
|
||||
|
||||
CREATE SEQUENCE orcid_token_id_seq;
|
||||
|
||||
CREATE TABLE orcid_token
|
||||
(
|
||||
id INTEGER NOT NULL,
|
||||
eperson_id RAW(16) NOT NULL UNIQUE,
|
||||
profile_item_id RAW(16),
|
||||
access_token VARCHAR2(100) NOT NULL,
|
||||
CONSTRAINT orcid_token_pkey PRIMARY KEY (id),
|
||||
CONSTRAINT orcid_token_eperson_id_fkey FOREIGN KEY (eperson_id) REFERENCES eperson (uuid),
|
||||
CONSTRAINT orcid_token_profile_item_id_fkey FOREIGN KEY (profile_item_id) REFERENCES item (uuid)
|
||||
);
|
@@ -1,18 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Table to store Groups related to a Process on its creation
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
CREATE TABLE Process2Group
|
||||
(
|
||||
process_id INTEGER REFERENCES Process(process_id),
|
||||
group_id UUID REFERENCES epersongroup (uuid) ON DELETE CASCADE,
|
||||
CONSTRAINT PK_Process2Group PRIMARY KEY (process_id, group_id)
|
||||
);
|
@@ -1,10 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-- NOTE: default 0 ensures that existing relations have "latest_version_status" set to "both" (first constant in enum, see Relationship class)
|
||||
ALTER TABLE relationship ADD latest_version_status INTEGER DEFAULT 0 NOT NULL;
|
@@ -1,45 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-----------------------------------------------------------------------------------
|
||||
-- ADD table subscription_parameter
|
||||
-----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
CREATE SEQUENCE if NOT EXISTS subscription_parameter_seq;
|
||||
-----------------------------------------------------------------------------------
|
||||
-- ADD table subscription_parameter
|
||||
-----------------------------------------------------------------------------------
|
||||
CREATE TABLE if NOT EXISTS subscription_parameter
|
||||
(
|
||||
subscription_parameter_id INTEGER NOT NULL,
|
||||
name VARCHAR(255),
|
||||
value VARCHAR(255),
|
||||
subscription_id INTEGER NOT NULL,
|
||||
CONSTRAINT subscription_parameter_pkey PRIMARY KEY (subscription_parameter_id),
|
||||
CONSTRAINT subscription_parameter_subscription_fkey FOREIGN KEY (subscription_id)
|
||||
REFERENCES subscription (subscription_id) ON DELETE CASCADE
|
||||
);
|
||||
-- --
|
||||
|
||||
ALTER TABLE subscription ADD COLUMN if NOT EXISTS dspace_object_id UUID;
|
||||
---- --
|
||||
ALTER TABLE subscription ADD COLUMN if NOT EXISTS type CHARACTER VARYING(255);
|
||||
--
|
||||
UPDATE subscription SET dspace_object_id = collection_id , type = 'content';
|
||||
--
|
||||
ALTER TABLE subscription DROP CONSTRAINT IF EXISTS subscription_dspaceobject_fkey;
|
||||
ALTER TABLE subscription ADD CONSTRAINT subscription_dspaceobject_fkey FOREIGN KEY (dspace_object_id) REFERENCES dspaceobject (uuid);
|
||||
--
|
||||
ALTER TABLE subscription DROP CONSTRAINT IF EXISTS subscription_collection_id_fkey;
|
||||
---- --
|
||||
ALTER TABLE subscription DROP COLUMN IF EXISTS collection_id;
|
||||
-- --
|
||||
INSERT INTO subscription_parameter (subscription_parameter_id, name, value, subscription_id)
|
||||
SELECT getnextid('subscription_parameter'), 'frequency', 'D', subscription_id from "subscription" ;
|
||||
|
@@ -1,78 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Table to store supervision orders
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
CREATE TABLE supervision_orders
|
||||
(
|
||||
id INTEGER PRIMARY KEY,
|
||||
item_id UUID REFERENCES Item(uuid) ON DELETE CASCADE,
|
||||
eperson_group_id UUID REFERENCES epersongroup(uuid) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE SEQUENCE supervision_orders_seq;
|
||||
|
||||
INSERT INTO supervision_orders (id, item_id, eperson_group_id)
|
||||
SELECT supervision_orders_seq.nextval AS id, w.item_id, e.uuid
|
||||
FROM epersongroup2workspaceitem ew INNER JOIN workspaceitem w
|
||||
ON ew.workspace_item_id = w.workspace_item_id
|
||||
INNER JOIN epersongroup e
|
||||
ON ew.eperson_group_id = e.uuid;
|
||||
|
||||
|
||||
-- UPDATE policies for supervision orders
|
||||
-- items, bundles and bitstreams
|
||||
|
||||
DECLARE
|
||||
BEGIN
|
||||
|
||||
FOR rec IN
|
||||
(
|
||||
SELECT so.item_id as dspace_object, so.eperson_group_id, rp.resource_type_id
|
||||
FROM supervision_orders so
|
||||
INNER JOIN RESOURCEPOLICY rp on so.item_id = rp.dspace_object
|
||||
AND so.eperson_group_id = rp.epersongroup_id
|
||||
WHERE rp.rptype IS NULL
|
||||
|
||||
UNION
|
||||
|
||||
SELECT ib.bundle_id as dspace_object, so.eperson_group_id, rp.resource_type_id
|
||||
FROM supervision_orders so
|
||||
INNER JOIN item2bundle ib ON so.item_id = ib.item_id
|
||||
INNER JOIN RESOURCEPOLICY rp on ib.bundle_id = rp.dspace_object
|
||||
AND so.eperson_group_id = rp.epersongroup_id
|
||||
WHERE rp.rptype IS NULL
|
||||
|
||||
UNION
|
||||
|
||||
SELECT bs.bitstream_id as dspace_object, so.eperson_group_id, rp.resource_type_id
|
||||
FROM supervision_orders so
|
||||
INNER JOIN item2bundle ib ON so.item_id = ib.item_id
|
||||
INNER JOIN bundle2bitstream bs ON ib.bundle_id = bs.bundle_id
|
||||
INNER JOIN RESOURCEPOLICY rp on bs.bitstream_id = rp.dspace_object
|
||||
AND so.eperson_group_id = rp.epersongroup_id
|
||||
WHERE rp.rptype IS NULL
|
||||
)
|
||||
|
||||
LOOP
|
||||
|
||||
UPDATE RESOURCEPOLICY SET rptype = 'TYPE_SUBMISSION'
|
||||
where dspace_object = rec.dspace_object
|
||||
AND epersongroup_id = rec.eperson_group_id
|
||||
AND rptype IS NULL;
|
||||
|
||||
END LOOP;
|
||||
END;
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- drop epersongroup2workspaceitem table
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
DROP TABLE epersongroup2workspaceitem;
|
@@ -1,22 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-----------------------------------------------------------------------------------
|
||||
-- Create table for System wide alerts
|
||||
-----------------------------------------------------------------------------------
|
||||
|
||||
CREATE SEQUENCE alert_id_seq;
|
||||
|
||||
CREATE TABLE systemwidealert
|
||||
(
|
||||
alert_id INTEGER NOT NULL PRIMARY KEY,
|
||||
message VARCHAR(512),
|
||||
allow_sessions VARCHAR(64),
|
||||
countdown_to TIMESTAMP,
|
||||
active BOOLEAN
|
||||
);
|
@@ -1,17 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-----------------------------------------------------------------------------------
|
||||
-- Update short description for PNG mimetype in the bitstream format registry
|
||||
-- See: https://github.com/DSpace/DSpace/pull/8722
|
||||
-----------------------------------------------------------------------------------
|
||||
|
||||
UPDATE bitstreamformatregistry
|
||||
SET short_description='PNG'
|
||||
WHERE short_description='image/png'
|
||||
AND mimetype='image/png';
|
@@ -1,10 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
ALTER TABLE orcid_history MODIFY (description CLOB);
|
||||
ALTER TABLE orcid_queue MODIFY (description CLOB);
|
@@ -1,77 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-- SQL code to update the ID (primary key) generating sequences, if some
|
||||
-- import operation has set explicit IDs.
|
||||
--
|
||||
-- Sequences are used to generate IDs for new rows in the database. If a
|
||||
-- bulk import operation, such as an SQL dump, specifies primary keys for
|
||||
-- imported data explicitly, the sequences are out of sync and need updating.
|
||||
-- This SQL code does just that.
|
||||
--
|
||||
-- This should rarely be needed; any bulk import should be performed using the
|
||||
-- org.dspace.content API which is safe to use concurrently and in multiple
|
||||
-- JVMs. The SQL code below will typically only be required after a direct
|
||||
-- SQL data dump from a backup or somesuch.
|
||||
|
||||
-- The 'updateseq' procedure was derived from incseq.sql found at:
|
||||
-- http://www.akadia.com/services/scripts/incseq.sql
|
||||
|
||||
DECLARE
|
||||
PROCEDURE updateseq ( seq IN VARCHAR,
|
||||
tbl IN VARCHAR,
|
||||
attr IN VARCHAR,
|
||||
cond IN VARCHAR DEFAULT '' ) IS
|
||||
curr NUMBER := 0;
|
||||
BEGIN
|
||||
EXECUTE IMMEDIATE 'SELECT max(' || attr
|
||||
|| ') FROM ' || tbl
|
||||
|| ' ' || cond
|
||||
INTO curr;
|
||||
curr := curr + 1;
|
||||
EXECUTE IMMEDIATE 'DROP SEQUENCE ' || seq;
|
||||
EXECUTE IMMEDIATE 'CREATE SEQUENCE '
|
||||
|| seq
|
||||
|| ' START WITH '
|
||||
|| NVL(curr, 1);
|
||||
END updateseq;
|
||||
|
||||
BEGIN
|
||||
updateseq('bitstreamformatregistry_seq', 'bitstreamformatregistry',
|
||||
'bitstream_format_id');
|
||||
updateseq('fileextension_seq', 'fileextension', 'file_extension_id');
|
||||
updateseq('resourcepolicy_seq', 'resourcepolicy', 'policy_id');
|
||||
updateseq('workspaceitem_seq', 'workspaceitem', 'workspace_item_id');
|
||||
updateseq('registrationdata_seq', 'registrationdata',
|
||||
'registrationdata_id');
|
||||
updateseq('subscription_seq', 'subscription', 'subscription_id');
|
||||
updateseq('metadatafieldregistry_seq', 'metadatafieldregistry',
|
||||
'metadata_field_id');
|
||||
updateseq('metadatavalue_seq', 'metadatavalue', 'metadata_value_id');
|
||||
updateseq('metadataschemaregistry_seq', 'metadataschemaregistry',
|
||||
'metadata_schema_id');
|
||||
updateseq('harvested_collection_seq', 'harvested_collection', 'id');
|
||||
updateseq('harvested_item_seq', 'harvested_item', 'id');
|
||||
updateseq('webapp_seq', 'webapp', 'webapp_id');
|
||||
updateseq('requestitem_seq', 'requestitem', 'requestitem_id');
|
||||
updateseq('handle_id_seq', 'handle', 'handle_id');
|
||||
|
||||
-- Handle Sequence is a special case. Since Handles minted by DSpace
|
||||
-- use the 'handle_seq', we need to ensure the next assigned handle
|
||||
-- will *always* be unique. So, 'handle_seq' always needs to be set
|
||||
-- to the value of the *largest* handle suffix. That way when the
|
||||
-- next handle is assigned, it will use the next largest number. This
|
||||
-- query does the following:
|
||||
-- For all 'handle' values which have a number in their suffix
|
||||
-- (after '/'), find the maximum suffix value, convert it to a
|
||||
-- number, and set the 'handle_seq' to start at the next value (see
|
||||
-- updateseq above for more).
|
||||
updateseq('handle_seq', 'handle',
|
||||
q'{to_number(regexp_replace(handle, '.*/', ''), '999999999999')}',
|
||||
q'{WHERE REGEXP_LIKE(handle, '^.*/[0123456789]*$')}');
|
||||
END;
|
@@ -3,8 +3,9 @@
|
||||
The SQL scripts in this directory are PostgreSQL-specific database migrations. They are
|
||||
used to automatically upgrade your DSpace database using [Flyway](http://flywaydb.org/).
|
||||
As such, these scripts are automatically called by Flyway when the DSpace
|
||||
`DatabaseManager` initializes itself (see `initializeDatabase()` method). During
|
||||
that process, Flyway determines which version of DSpace your database is using
|
||||
`DatabaseUtils` initializes.
|
||||
|
||||
During that process, Flyway determines which version of DSpace your database is using
|
||||
and then executes the appropriate upgrade script(s) to bring it up to the latest
|
||||
version.
|
||||
|
||||
@@ -22,7 +23,7 @@ Please see the Flyway Documentation for more information: http://flywaydb.org/
|
||||
The `update-sequences.sql` script in this directory may still be used to update
|
||||
your internal database counts if you feel they have gotten out of "sync". This
|
||||
may sometimes occur after large restores of content (e.g. when using the DSpace
|
||||
[AIP Backup and Restore](https://wiki.duraspace.org/display/DSDOC5x/AIP+Backup+and+Restore)
|
||||
[AIP Backup and Restore](https://wiki.lyrasis.org/display/DSDOC7x/AIP+Backup+and+Restore)
|
||||
feature).
|
||||
|
||||
This `update-sequences.sql` script can be executed by running
|
||||
|
@@ -1,503 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
-- DS-3431 Workflow system is vulnerable to unauthorized manipulations --
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- grant claiming permissions to all workflow step groups (step 1-3) --
|
||||
-----------------------------------------------------------------------
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, epersongroup_id, resource_id)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL AS policy_id,
|
||||
'3' AS resource_type_id,
|
||||
'5' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
workflow_step_1 AS epersongroup_id,
|
||||
collection_id AS dspace_object
|
||||
FROM collection
|
||||
WHERE workflow_step_1 IS NOT NULL
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 3 AND action_id = 5 AND epersongroup_id = workflow_step_1 and resource_id = collection_id
|
||||
);
|
||||
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, epersongroup_id, resource_id)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL AS policy_id,
|
||||
'3' AS resource_type_id,
|
||||
'6' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
workflow_step_2 AS epersongroup_id,
|
||||
collection_id AS dspace_object
|
||||
FROM collection
|
||||
WHERE workflow_step_2 IS NOT NULL
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 3 AND action_id = 6 AND epersongroup_id = workflow_step_2 and resource_id = collection_id
|
||||
);
|
||||
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, epersongroup_id, resource_id)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL AS policy_id,
|
||||
'3' AS resource_type_id,
|
||||
'7' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
workflow_step_3 AS epersongroup_id,
|
||||
collection_id AS dspace_object
|
||||
FROM collection
|
||||
WHERE workflow_step_3 IS NOT NULL
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 3 AND action_id = 7 AND epersongroup_id = workflow_step_3 and resource_id = collection_id
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- grant add permissions to all workflow step groups (step 1-3) --
|
||||
-----------------------------------------------------------------------
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, epersongroup_id, resource_id)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL AS policy_id,
|
||||
'3' AS resource_type_id,
|
||||
'3' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
workflow_step_1 AS epersongroup_id,
|
||||
collection_id AS dspace_object
|
||||
FROM collection
|
||||
WHERE workflow_step_1 IS NOT NULL
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 3 AND action_id = 3 AND epersongroup_id = workflow_step_1 and resource_id = collection_id
|
||||
);
|
||||
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, epersongroup_id, resource_id)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL AS policy_id,
|
||||
'3' AS resource_type_id,
|
||||
'3' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
workflow_step_2 AS epersongroup_id,
|
||||
collection_id AS dspace_object
|
||||
FROM collection
|
||||
WHERE workflow_step_2 IS NOT NULL
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 3 AND action_id = 3 AND epersongroup_id = workflow_step_2 and resource_id = collection_id
|
||||
);
|
||||
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, epersongroup_id, resource_id)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL AS policy_id,
|
||||
'3' AS resource_type_id,
|
||||
'3' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
workflow_step_3 AS epersongroup_id,
|
||||
collection_id AS dspace_object
|
||||
FROM collection
|
||||
WHERE workflow_step_3 IS NOT NULL
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 3 AND action_id = 3 AND epersongroup_id = workflow_step_3 and resource_id = collection_id
|
||||
);
|
||||
|
||||
----------------------------------------------------------------------------------
|
||||
-- grant read/write/delete/add/remove permission on workflow items to reviewers --
|
||||
----------------------------------------------------------------------------------
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, eperson_id, resource_id)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL AS policy_id,
|
||||
'2' AS resource_type_id,
|
||||
'0' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
owner AS eperson_id,
|
||||
item_id AS dspace_object
|
||||
FROM workflowitem
|
||||
WHERE
|
||||
owner IS NOT NULL
|
||||
AND (state = 2 OR state = 4 OR state = 6)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 2 AND action_id = 0 AND eperson_id = owner AND resource_id = item_id
|
||||
);
|
||||
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, eperson_id, resource_id)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL AS policy_id,
|
||||
'2' AS resource_type_id,
|
||||
'1' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
owner AS eperson_id,
|
||||
item_id AS dspace_object
|
||||
FROM workflowitem
|
||||
WHERE
|
||||
owner IS NOT NULL
|
||||
AND (state = 2 OR state = 4 OR state = 6)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 2 AND action_id = 1 AND eperson_id = owner AND resource_id = item_id
|
||||
);
|
||||
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, eperson_id, resource_id)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL AS policy_id,
|
||||
'2' AS resource_type_id,
|
||||
'2' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
owner AS eperson_id,
|
||||
item_id AS dspace_object
|
||||
FROM workflowitem
|
||||
WHERE
|
||||
owner IS NOT NULL
|
||||
AND (state = 2 OR state = 4 OR state = 6)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 2 AND action_id = 2 AND eperson_id = owner AND resource_id = item_id
|
||||
);
|
||||
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, eperson_id, resource_id)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL AS policy_id,
|
||||
'2' AS resource_type_id,
|
||||
'3' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
owner AS eperson_id,
|
||||
item_id AS dspace_object
|
||||
FROM workflowitem
|
||||
WHERE
|
||||
owner IS NOT NULL
|
||||
AND (state = 2 OR state = 4 OR state = 6)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 2 AND action_id = 3 AND eperson_id = owner AND resource_id = item_id
|
||||
);
|
||||
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, eperson_id, resource_id)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL AS policy_id,
|
||||
'2' AS resource_type_id,
|
||||
'4' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
owner AS eperson_id,
|
||||
item_id AS dspace_object
|
||||
FROM workflowitem
|
||||
WHERE
|
||||
owner IS NOT NULL
|
||||
AND (state = 2 OR state = 4 OR state = 6)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 2 AND action_id = 4 AND eperson_id = owner AND resource_id = item_id
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------------------
|
||||
-- grant read/write/delete/add/remove permission on Bundle ORIGINAL to reviewers --
|
||||
-----------------------------------------------------------------------------------
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, eperson_id, resource_id)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL AS policy_id,
|
||||
'1' AS resource_type_id,
|
||||
'0' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
wfi.owner AS eperson_id,
|
||||
i2b.bundle_id AS dspace_object
|
||||
FROM workflowitem wfi
|
||||
JOIN item2bundle i2b
|
||||
ON i2b.item_id = wfi.item_id
|
||||
JOIN metadatavalue mv
|
||||
ON mv.resource_id = i2b.bundle_id
|
||||
JOIN metadatafieldregistry mfr
|
||||
ON mv.metadata_field_id = mfr.metadata_field_id
|
||||
JOIN metadataschemaregistry msr
|
||||
ON mfr.metadata_schema_id = msr.metadata_schema_id
|
||||
WHERE
|
||||
msr.namespace = 'http://dublincore.org/documents/dcmi-terms/'
|
||||
AND mfr.element = 'title'
|
||||
AND mfr.qualifier IS NULL
|
||||
AND mv.text_value LIKE 'ORIGINAL'
|
||||
AND wfi.owner IS NOT NULL
|
||||
AND (wfi.state = 2 OR wfi.state = 4 OR wfi.state = 6)
|
||||
AND NOT EXISTS(
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 1 AND action_id = 0 AND resourcepolicy.eperson_id = owner AND resourcepolicy.resource_id = i2b.bundle_id
|
||||
);
|
||||
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, eperson_id, resource_id)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL AS policy_id,
|
||||
'1' AS resource_type_id,
|
||||
'1' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
wfi.owner AS eperson_id,
|
||||
i2b.bundle_id AS dspace_object
|
||||
FROM workflowitem wfi
|
||||
JOIN item2bundle i2b
|
||||
ON i2b.item_id = wfi.item_id
|
||||
JOIN metadatavalue mv
|
||||
ON mv.resource_id = i2b.bundle_id
|
||||
JOIN metadatafieldregistry mfr
|
||||
ON mv.metadata_field_id = mfr.metadata_field_id
|
||||
JOIN metadataschemaregistry msr
|
||||
ON mfr.metadata_schema_id = msr.metadata_schema_id
|
||||
WHERE
|
||||
msr.namespace = 'http://dublincore.org/documents/dcmi-terms/'
|
||||
AND mfr.element = 'title'
|
||||
AND mfr.qualifier IS NULL
|
||||
AND mv.text_value LIKE 'ORIGINAL'
|
||||
AND wfi.owner IS NOT NULL
|
||||
AND (wfi.state = 2 OR wfi.state = 4 OR wfi.state = 6)
|
||||
AND NOT EXISTS(
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 1 AND action_id = 1 AND resourcepolicy.eperson_id = owner AND resourcepolicy.resource_id = i2b.bundle_id
|
||||
);
|
||||
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, eperson_id, resource_id)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL AS policy_id,
|
||||
'1' AS resource_type_id,
|
||||
'2' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
wfi.owner AS eperson_id,
|
||||
i2b.bundle_id AS dspace_object
|
||||
FROM workflowitem wfi
|
||||
JOIN item2bundle i2b
|
||||
ON i2b.item_id = wfi.item_id
|
||||
JOIN metadatavalue mv
|
||||
ON mv.resource_id = i2b.bundle_id
|
||||
JOIN metadatafieldregistry mfr
|
||||
ON mv.metadata_field_id = mfr.metadata_field_id
|
||||
JOIN metadataschemaregistry msr
|
||||
ON mfr.metadata_schema_id = msr.metadata_schema_id
|
||||
WHERE
|
||||
msr.namespace = 'http://dublincore.org/documents/dcmi-terms/'
|
||||
AND mfr.element = 'title'
|
||||
AND mfr.qualifier IS NULL
|
||||
AND mv.text_value LIKE 'ORIGINAL'
|
||||
AND wfi.owner IS NOT NULL
|
||||
AND (wfi.state = 2 OR wfi.state = 4 OR wfi.state = 6)
|
||||
AND NOT EXISTS(
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 1 AND action_id = 2 AND resourcepolicy.eperson_id = owner AND resourcepolicy.resource_id = i2b.bundle_id
|
||||
);
|
||||
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, eperson_id, resource_id)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL AS policy_id,
|
||||
'1' AS resource_type_id,
|
||||
'3' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
wfi.owner AS eperson_id,
|
||||
i2b.bundle_id AS dspace_object
|
||||
FROM workflowitem wfi
|
||||
JOIN item2bundle i2b
|
||||
ON i2b.item_id = wfi.item_id
|
||||
JOIN metadatavalue mv
|
||||
ON mv.resource_id = i2b.bundle_id
|
||||
JOIN metadatafieldregistry mfr
|
||||
ON mv.metadata_field_id = mfr.metadata_field_id
|
||||
JOIN metadataschemaregistry msr
|
||||
ON mfr.metadata_schema_id = msr.metadata_schema_id
|
||||
WHERE
|
||||
msr.namespace = 'http://dublincore.org/documents/dcmi-terms/'
|
||||
AND mfr.element = 'title'
|
||||
AND mfr.qualifier IS NULL
|
||||
AND mv.text_value LIKE 'ORIGINAL'
|
||||
AND wfi.owner IS NOT NULL
|
||||
AND (wfi.state = 2 OR wfi.state = 4 OR wfi.state = 6)
|
||||
AND NOT EXISTS(
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 1 AND action_id = 3 AND resourcepolicy.eperson_id = owner AND resourcepolicy.resource_id = i2b.bundle_id
|
||||
);
|
||||
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, eperson_id, resource_id)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL AS policy_id,
|
||||
'1' AS resource_type_id,
|
||||
'4' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
wfi.owner AS eperson_id,
|
||||
i2b.bundle_id AS dspace_object
|
||||
FROM workflowitem wfi
|
||||
JOIN item2bundle i2b
|
||||
ON i2b.item_id = wfi.item_id
|
||||
JOIN metadatavalue mv
|
||||
ON mv.resource_id = i2b.bundle_id
|
||||
JOIN metadatafieldregistry mfr
|
||||
ON mv.metadata_field_id = mfr.metadata_field_id
|
||||
JOIN metadataschemaregistry msr
|
||||
ON mfr.metadata_schema_id = msr.metadata_schema_id
|
||||
WHERE
|
||||
msr.namespace = 'http://dublincore.org/documents/dcmi-terms/'
|
||||
AND mfr.element = 'title'
|
||||
AND mfr.qualifier IS NULL
|
||||
AND mv.text_value LIKE 'ORIGINAL'
|
||||
AND wfi.owner IS NOT NULL
|
||||
AND (wfi.state = 2 OR wfi.state = 4 OR wfi.state = 6)
|
||||
AND NOT EXISTS(
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 1 AND action_id = 4 AND resourcepolicy.eperson_id = owner AND resourcepolicy.resource_id = i2b.bundle_id
|
||||
);
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- grant read/write/delete/add/remove permission on all Bitstreams of Bundle --
|
||||
-- ORIGINAL to reviewers --
|
||||
-------------------------------------------------------------------------------
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, eperson_id, resource_id)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL AS policy_id,
|
||||
'0' AS resource_type_id,
|
||||
'0' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
wfi.owner AS eperson_id,
|
||||
b2b.bitstream_id AS dspace_object
|
||||
FROM workflowitem wfi
|
||||
JOIN item2bundle i2b
|
||||
ON i2b.item_id = wfi.item_id
|
||||
JOIN bundle2bitstream b2b
|
||||
ON b2b.bundle_id = i2b.bundle_id
|
||||
JOIN metadatavalue mv
|
||||
ON mv.resource_id = i2b.bundle_id
|
||||
JOIN metadatafieldregistry mfr
|
||||
ON mv.metadata_field_id = mfr.metadata_field_id
|
||||
JOIN metadataschemaregistry msr
|
||||
ON mfr.metadata_schema_id = msr.metadata_schema_id
|
||||
WHERE
|
||||
msr.namespace = 'http://dublincore.org/documents/dcmi-terms/'
|
||||
AND mfr.element = 'title'
|
||||
AND mfr.qualifier IS NULL
|
||||
AND mv.text_value LIKE 'ORIGINAL'
|
||||
AND wfi.owner IS NOT NULL
|
||||
AND (wfi.state = 2 OR wfi.state = 4 OR wfi.state = 6)
|
||||
AND NOT EXISTS(
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 0 AND action_id = 0 AND resourcepolicy.eperson_id = owner AND resourcepolicy.resource_id = b2b.bitstream_id
|
||||
);
|
||||
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, eperson_id, resource_id)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL AS policy_id,
|
||||
'0' AS resource_type_id,
|
||||
'1' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
wfi.owner AS eperson_id,
|
||||
b2b.bitstream_id AS dspace_object
|
||||
FROM workflowitem wfi
|
||||
JOIN item2bundle i2b
|
||||
ON i2b.item_id = wfi.item_id
|
||||
JOIN bundle2bitstream b2b
|
||||
ON b2b.bundle_id = i2b.bundle_id
|
||||
JOIN metadatavalue mv
|
||||
ON mv.resource_id = i2b.bundle_id
|
||||
JOIN metadatafieldregistry mfr
|
||||
ON mv.metadata_field_id = mfr.metadata_field_id
|
||||
JOIN metadataschemaregistry msr
|
||||
ON mfr.metadata_schema_id = msr.metadata_schema_id
|
||||
WHERE
|
||||
msr.namespace = 'http://dublincore.org/documents/dcmi-terms/'
|
||||
AND mfr.element = 'title'
|
||||
AND mfr.qualifier IS NULL
|
||||
AND mv.text_value LIKE 'ORIGINAL'
|
||||
AND wfi.owner IS NOT NULL
|
||||
AND (wfi.state = 2 OR wfi.state = 4 OR wfi.state = 6)
|
||||
AND NOT EXISTS(
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 0 AND action_id = 1 AND resourcepolicy.eperson_id = owner AND resourcepolicy.resource_id = b2b.bitstream_id
|
||||
);
|
||||
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, eperson_id, resource_id)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL policy_id,
|
||||
'0' AS resource_type_id,
|
||||
'2' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
wfi.owner AS eperson_id,
|
||||
b2b.bitstream_id AS dspace_object
|
||||
FROM workflowitem wfi
|
||||
JOIN item2bundle i2b
|
||||
ON i2b.item_id = wfi.item_id
|
||||
JOIN bundle2bitstream b2b
|
||||
ON b2b.bundle_id = i2b.bundle_id
|
||||
JOIN metadatavalue mv
|
||||
ON mv.resource_id = i2b.bundle_id
|
||||
JOIN metadatafieldregistry mfr
|
||||
ON mv.metadata_field_id = mfr.metadata_field_id
|
||||
JOIN metadataschemaregistry msr
|
||||
ON mfr.metadata_schema_id = msr.metadata_schema_id
|
||||
WHERE
|
||||
msr.namespace = 'http://dublincore.org/documents/dcmi-terms/'
|
||||
AND mfr.element = 'title'
|
||||
AND mfr.qualifier IS NULL
|
||||
AND mv.text_value LIKE 'ORIGINAL'
|
||||
AND wfi.owner IS NOT NULL
|
||||
AND (wfi.state = 2 OR wfi.state = 4 OR wfi.state = 6)
|
||||
AND NOT EXISTS(
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 0 AND action_id = 2 AND resourcepolicy.eperson_id = owner AND resourcepolicy.resource_id = b2b.bitstream_id
|
||||
);
|
||||
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, eperson_id, resource_id)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL AS policy_id,
|
||||
'0' AS resource_type_id,
|
||||
'3' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
wfi.owner AS eperson_id,
|
||||
b2b.bitstream_id AS dspace_object
|
||||
FROM workflowitem wfi
|
||||
JOIN item2bundle i2b
|
||||
ON i2b.item_id = wfi.item_id
|
||||
JOIN bundle2bitstream b2b
|
||||
ON b2b.bundle_id = i2b.bundle_id
|
||||
JOIN metadatavalue mv
|
||||
ON mv.resource_id = i2b.bundle_id
|
||||
JOIN metadatafieldregistry mfr
|
||||
ON mv.metadata_field_id = mfr.metadata_field_id
|
||||
JOIN metadataschemaregistry msr
|
||||
ON mfr.metadata_schema_id = msr.metadata_schema_id
|
||||
WHERE
|
||||
msr.namespace = 'http://dublincore.org/documents/dcmi-terms/'
|
||||
AND mfr.element = 'title'
|
||||
AND mfr.qualifier IS NULL
|
||||
AND mv.text_value LIKE 'ORIGINAL'
|
||||
AND wfi.owner IS NOT NULL
|
||||
AND (wfi.state = 2 OR wfi.state = 4 OR wfi.state = 6)
|
||||
AND NOT EXISTS(
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 0 AND action_id = 3 AND resourcepolicy.eperson_id = owner AND resourcepolicy.resource_id = b2b.bitstream_id
|
||||
);
|
||||
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, eperson_id, resource_id)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL AS policy_id,
|
||||
'0' AS resource_type_id,
|
||||
'4' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
wfi.owner AS eperson_id,
|
||||
b2b.bitstream_id AS dspace_object
|
||||
FROM workflowitem wfi
|
||||
JOIN item2bundle i2b
|
||||
ON i2b.item_id = wfi.item_id
|
||||
JOIN bundle2bitstream b2b
|
||||
ON b2b.bundle_id = i2b.bundle_id
|
||||
JOIN metadatavalue mv
|
||||
ON mv.resource_id = i2b.bundle_id
|
||||
JOIN metadatafieldregistry mfr
|
||||
ON mv.metadata_field_id = mfr.metadata_field_id
|
||||
JOIN metadataschemaregistry msr
|
||||
ON mfr.metadata_schema_id = msr.metadata_schema_id
|
||||
WHERE
|
||||
msr.namespace = 'http://dublincore.org/documents/dcmi-terms/'
|
||||
AND mfr.element = 'title'
|
||||
AND mfr.qualifier IS NULL
|
||||
AND mv.text_value LIKE 'ORIGINAL'
|
||||
AND wfi.owner IS NOT NULL
|
||||
AND (wfi.state = 2 OR wfi.state = 4 OR wfi.state = 6)
|
||||
AND NOT EXISTS(
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 0 AND action_id = 4 AND resourcepolicy.eperson_id = owner AND resourcepolicy.resource_id = b2b.bitstream_id
|
||||
);
|
@@ -1,37 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
------------------------------------------------------
|
||||
-- DS-2701 Service based API / Hibernate integration
|
||||
------------------------------------------------------
|
||||
-- Alter workflow item
|
||||
ALTER TABLE workflowitem RENAME COLUMN item_id to item_legacy_id;
|
||||
ALTER TABLE workflowitem ADD item_id RAW(16) REFERENCES Item(uuid);
|
||||
UPDATE workflowitem SET item_id = (SELECT item.uuid FROM item WHERE workflowitem.item_legacy_id = item.item_id);
|
||||
ALTER TABLE workflowitem DROP COLUMN item_legacy_id;
|
||||
|
||||
-- Migrate task list item
|
||||
ALTER TABLE TasklistItem RENAME COLUMN eperson_id to eperson_legacy_id;
|
||||
ALTER TABLE TasklistItem ADD eperson_id RAW(16) REFERENCES EPerson(uuid);
|
||||
UPDATE TasklistItem SET eperson_id = (SELECT eperson.uuid FROM eperson WHERE TasklistItem.eperson_legacy_id = eperson.eperson_id);
|
||||
ALTER TABLE TasklistItem DROP COLUMN eperson_legacy_id;
|
||||
|
||||
-- Migrate task workflow item
|
||||
ALTER TABLE workflowitem RENAME COLUMN collection_id to collection_legacy_id;
|
||||
ALTER TABLE workflowitem ADD collection_id RAW(16) REFERENCES Collection(uuid);
|
||||
UPDATE workflowitem SET collection_id = (SELECT collection.uuid FROM collection WHERE workflowitem.collection_legacy_id = collection.collection_id);
|
||||
ALTER TABLE workflowitem DROP COLUMN collection_legacy_id;
|
||||
ALTER TABLE workflowitem RENAME COLUMN owner to owner_legacy_id;
|
||||
ALTER TABLE workflowitem ADD owner RAW(16) REFERENCES EPerson (uuid);
|
||||
UPDATE workflowitem SET owner = (SELECT eperson.uuid FROM eperson WHERE workflowitem.owner_legacy_id = eperson.eperson_id);
|
||||
ALTER TABLE workflowitem DROP COLUMN owner_legacy_id;
|
||||
UPDATE workflowitem SET state = -1 WHERE state IS NULL;
|
||||
UPDATE workflowitem SET multiple_titles = '0' WHERE multiple_titles IS NULL;
|
||||
UPDATE workflowitem SET published_before = '0' WHERE published_before IS NULL;
|
||||
UPDATE workflowitem SET multiple_files = '0' WHERE multiple_files IS NULL;
|
||||
|
@@ -1,503 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
-- DS-3431 Workflow system is vulnerable to unauthorized manipulations --
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- grant claiming permissions to all workflow step groups (step 1-3) --
|
||||
-----------------------------------------------------------------------
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, epersongroup_id, dspace_object)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL AS policy_id,
|
||||
'3' AS resource_type_id,
|
||||
'5' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
workflow_step_1 AS epersongroup_id,
|
||||
uuid AS dspace_object
|
||||
FROM collection
|
||||
WHERE workflow_step_1 IS NOT NULL
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 3 AND action_id = 5 AND epersongroup_id = workflow_step_1 and dspace_object = uuid
|
||||
);
|
||||
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, epersongroup_id, dspace_object)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL AS policy_id,
|
||||
'3' AS resource_type_id,
|
||||
'6' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
workflow_step_2 AS epersongroup_id,
|
||||
uuid AS dspace_object
|
||||
FROM collection
|
||||
WHERE workflow_step_2 IS NOT NULL
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 3 AND action_id = 6 AND epersongroup_id = workflow_step_2 and dspace_object = uuid
|
||||
);
|
||||
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, epersongroup_id, dspace_object)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL AS policy_id,
|
||||
'3' AS resource_type_id,
|
||||
'7' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
workflow_step_3 AS epersongroup_id,
|
||||
uuid AS dspace_object
|
||||
FROM collection
|
||||
WHERE workflow_step_3 IS NOT NULL
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 3 AND action_id = 7 AND epersongroup_id = workflow_step_3 and dspace_object = uuid
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- grant add permissions to all workflow step groups (step 1-3) --
|
||||
-----------------------------------------------------------------------
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, epersongroup_id, dspace_object)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL AS policy_id,
|
||||
'3' AS resource_type_id,
|
||||
'3' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
workflow_step_1 AS epersongroup_id,
|
||||
uuid AS dspace_object
|
||||
FROM collection
|
||||
WHERE workflow_step_1 IS NOT NULL
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 3 AND action_id = 3 AND epersongroup_id = workflow_step_1 and dspace_object = uuid
|
||||
);
|
||||
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, epersongroup_id, dspace_object)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL AS policy_id,
|
||||
'3' AS resource_type_id,
|
||||
'3' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
workflow_step_2 AS epersongroup_id,
|
||||
uuid AS dspace_object
|
||||
FROM collection
|
||||
WHERE workflow_step_2 IS NOT NULL
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 3 AND action_id = 3 AND epersongroup_id = workflow_step_2 and dspace_object = uuid
|
||||
);
|
||||
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, epersongroup_id, dspace_object)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL AS policy_id,
|
||||
'3' AS resource_type_id,
|
||||
'3' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
workflow_step_3 AS epersongroup_id,
|
||||
uuid AS dspace_object
|
||||
FROM collection
|
||||
WHERE workflow_step_3 IS NOT NULL
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 3 AND action_id = 3 AND epersongroup_id = workflow_step_3 and dspace_object = uuid
|
||||
);
|
||||
|
||||
----------------------------------------------------------------------------------
|
||||
-- grant read/write/delete/add/remove permission on workflow items to reviewers --
|
||||
----------------------------------------------------------------------------------
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, eperson_id, dspace_object)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL AS policy_id,
|
||||
'2' AS resource_type_id,
|
||||
'0' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
owner AS eperson_id,
|
||||
item_id AS dspace_object
|
||||
FROM workflowitem
|
||||
WHERE
|
||||
owner IS NOT NULL
|
||||
AND (state = 2 OR state = 4 OR state = 6)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 2 AND action_id = 0 AND eperson_id = owner AND dspace_object = item_id
|
||||
);
|
||||
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, eperson_id, dspace_object)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL AS policy_id,
|
||||
'2' AS resource_type_id,
|
||||
'1' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
owner AS eperson_id,
|
||||
item_id AS dspace_object
|
||||
FROM workflowitem
|
||||
WHERE
|
||||
owner IS NOT NULL
|
||||
AND (state = 2 OR state = 4 OR state = 6)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 2 AND action_id = 1 AND eperson_id = owner AND dspace_object = item_id
|
||||
);
|
||||
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, eperson_id, dspace_object)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL AS policy_id,
|
||||
'2' AS resource_type_id,
|
||||
'2' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
owner AS eperson_id,
|
||||
item_id AS dspace_object
|
||||
FROM workflowitem
|
||||
WHERE
|
||||
owner IS NOT NULL
|
||||
AND (state = 2 OR state = 4 OR state = 6)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 2 AND action_id = 2 AND eperson_id = owner AND dspace_object = item_id
|
||||
);
|
||||
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, eperson_id, dspace_object)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL AS policy_id,
|
||||
'2' AS resource_type_id,
|
||||
'3' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
owner AS eperson_id,
|
||||
item_id AS dspace_object
|
||||
FROM workflowitem
|
||||
WHERE
|
||||
owner IS NOT NULL
|
||||
AND (state = 2 OR state = 4 OR state = 6)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 2 AND action_id = 3 AND eperson_id = owner AND dspace_object = item_id
|
||||
);
|
||||
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, eperson_id, dspace_object)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL AS policy_id,
|
||||
'2' AS resource_type_id,
|
||||
'4' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
owner AS eperson_id,
|
||||
item_id AS dspace_object
|
||||
FROM workflowitem
|
||||
WHERE
|
||||
owner IS NOT NULL
|
||||
AND (state = 2 OR state = 4 OR state = 6)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 2 AND action_id = 4 AND eperson_id = owner AND dspace_object = item_id
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------------------
|
||||
-- grant read/write/delete/add/remove permission on Bundle ORIGINAL to reviewers --
|
||||
-----------------------------------------------------------------------------------
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, eperson_id, dspace_object)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL AS policy_id,
|
||||
'1' AS resource_type_id,
|
||||
'0' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
wfi.owner AS eperson_id,
|
||||
i2b.bundle_id AS dspace_object
|
||||
FROM workflowitem wfi
|
||||
JOIN item2bundle i2b
|
||||
ON i2b.item_id = wfi.item_id
|
||||
JOIN metadatavalue mv
|
||||
ON mv.dspace_object_id = i2b.bundle_id
|
||||
JOIN metadatafieldregistry mfr
|
||||
ON mv.metadata_field_id = mfr.metadata_field_id
|
||||
JOIN metadataschemaregistry msr
|
||||
ON mfr.metadata_schema_id = msr.metadata_schema_id
|
||||
WHERE
|
||||
msr.namespace = 'http://dublincore.org/documents/dcmi-terms/'
|
||||
AND mfr.element = 'title'
|
||||
AND mfr.qualifier IS NULL
|
||||
AND mv.text_value LIKE 'ORIGINAL'
|
||||
AND wfi.owner IS NOT NULL
|
||||
AND (wfi.state = 2 OR wfi.state = 4 OR wfi.state = 6)
|
||||
AND NOT EXISTS(
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 1 AND action_id = 0 AND resourcepolicy.eperson_id = owner AND resourcepolicy.dspace_object = i2b.bundle_id
|
||||
);
|
||||
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, eperson_id, dspace_object)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL AS policy_id,
|
||||
'1' AS resource_type_id,
|
||||
'1' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
wfi.owner AS eperson_id,
|
||||
i2b.bundle_id AS dspace_object
|
||||
FROM workflowitem wfi
|
||||
JOIN item2bundle i2b
|
||||
ON i2b.item_id = wfi.item_id
|
||||
JOIN metadatavalue mv
|
||||
ON mv.dspace_object_id = i2b.bundle_id
|
||||
JOIN metadatafieldregistry mfr
|
||||
ON mv.metadata_field_id = mfr.metadata_field_id
|
||||
JOIN metadataschemaregistry msr
|
||||
ON mfr.metadata_schema_id = msr.metadata_schema_id
|
||||
WHERE
|
||||
msr.namespace = 'http://dublincore.org/documents/dcmi-terms/'
|
||||
AND mfr.element = 'title'
|
||||
AND mfr.qualifier IS NULL
|
||||
AND mv.text_value LIKE 'ORIGINAL'
|
||||
AND wfi.owner IS NOT NULL
|
||||
AND (wfi.state = 2 OR wfi.state = 4 OR wfi.state = 6)
|
||||
AND NOT EXISTS(
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 1 AND action_id = 1 AND resourcepolicy.eperson_id = owner AND resourcepolicy.dspace_object = i2b.bundle_id
|
||||
);
|
||||
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, eperson_id, dspace_object)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL AS policy_id,
|
||||
'1' AS resource_type_id,
|
||||
'2' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
wfi.owner AS eperson_id,
|
||||
i2b.bundle_id AS dspace_object
|
||||
FROM workflowitem wfi
|
||||
JOIN item2bundle i2b
|
||||
ON i2b.item_id = wfi.item_id
|
||||
JOIN metadatavalue mv
|
||||
ON mv.dspace_object_id = i2b.bundle_id
|
||||
JOIN metadatafieldregistry mfr
|
||||
ON mv.metadata_field_id = mfr.metadata_field_id
|
||||
JOIN metadataschemaregistry msr
|
||||
ON mfr.metadata_schema_id = msr.metadata_schema_id
|
||||
WHERE
|
||||
msr.namespace = 'http://dublincore.org/documents/dcmi-terms/'
|
||||
AND mfr.element = 'title'
|
||||
AND mfr.qualifier IS NULL
|
||||
AND mv.text_value LIKE 'ORIGINAL'
|
||||
AND wfi.owner IS NOT NULL
|
||||
AND (wfi.state = 2 OR wfi.state = 4 OR wfi.state = 6)
|
||||
AND NOT EXISTS(
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 1 AND action_id = 2 AND resourcepolicy.eperson_id = owner AND resourcepolicy.dspace_object = i2b.bundle_id
|
||||
);
|
||||
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, eperson_id, dspace_object)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL AS policy_id,
|
||||
'1' AS resource_type_id,
|
||||
'3' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
wfi.owner AS eperson_id,
|
||||
i2b.bundle_id AS dspace_object
|
||||
FROM workflowitem wfi
|
||||
JOIN item2bundle i2b
|
||||
ON i2b.item_id = wfi.item_id
|
||||
JOIN metadatavalue mv
|
||||
ON mv.dspace_object_id = i2b.bundle_id
|
||||
JOIN metadatafieldregistry mfr
|
||||
ON mv.metadata_field_id = mfr.metadata_field_id
|
||||
JOIN metadataschemaregistry msr
|
||||
ON mfr.metadata_schema_id = msr.metadata_schema_id
|
||||
WHERE
|
||||
msr.namespace = 'http://dublincore.org/documents/dcmi-terms/'
|
||||
AND mfr.element = 'title'
|
||||
AND mfr.qualifier IS NULL
|
||||
AND mv.text_value LIKE 'ORIGINAL'
|
||||
AND wfi.owner IS NOT NULL
|
||||
AND (wfi.state = 2 OR wfi.state = 4 OR wfi.state = 6)
|
||||
AND NOT EXISTS(
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 1 AND action_id = 3 AND resourcepolicy.eperson_id = owner AND resourcepolicy.dspace_object = i2b.bundle_id
|
||||
);
|
||||
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, eperson_id, dspace_object)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL AS policy_id,
|
||||
'1' AS resource_type_id,
|
||||
'4' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
wfi.owner AS eperson_id,
|
||||
i2b.bundle_id AS dspace_object
|
||||
FROM workflowitem wfi
|
||||
JOIN item2bundle i2b
|
||||
ON i2b.item_id = wfi.item_id
|
||||
JOIN metadatavalue mv
|
||||
ON mv.dspace_object_id = i2b.bundle_id
|
||||
JOIN metadatafieldregistry mfr
|
||||
ON mv.metadata_field_id = mfr.metadata_field_id
|
||||
JOIN metadataschemaregistry msr
|
||||
ON mfr.metadata_schema_id = msr.metadata_schema_id
|
||||
WHERE
|
||||
msr.namespace = 'http://dublincore.org/documents/dcmi-terms/'
|
||||
AND mfr.element = 'title'
|
||||
AND mfr.qualifier IS NULL
|
||||
AND mv.text_value LIKE 'ORIGINAL'
|
||||
AND wfi.owner IS NOT NULL
|
||||
AND (wfi.state = 2 OR wfi.state = 4 OR wfi.state = 6)
|
||||
AND NOT EXISTS(
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 1 AND action_id = 4 AND resourcepolicy.eperson_id = owner AND resourcepolicy.dspace_object = i2b.bundle_id
|
||||
);
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- grant read/write/delete/add/remove permission on all Bitstreams of Bundle --
|
||||
-- ORIGINAL to reviewers --
|
||||
-------------------------------------------------------------------------------
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, eperson_id, dspace_object)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL AS policy_id,
|
||||
'0' AS resource_type_id,
|
||||
'0' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
wfi.owner AS eperson_id,
|
||||
b2b.bitstream_id AS dspace_object
|
||||
FROM workflowitem wfi
|
||||
JOIN item2bundle i2b
|
||||
ON i2b.item_id = wfi.item_id
|
||||
JOIN bundle2bitstream b2b
|
||||
ON b2b.bundle_id = i2b.bundle_id
|
||||
JOIN metadatavalue mv
|
||||
ON mv.dspace_object_id = i2b.bundle_id
|
||||
JOIN metadatafieldregistry mfr
|
||||
ON mv.metadata_field_id = mfr.metadata_field_id
|
||||
JOIN metadataschemaregistry msr
|
||||
ON mfr.metadata_schema_id = msr.metadata_schema_id
|
||||
WHERE
|
||||
msr.namespace = 'http://dublincore.org/documents/dcmi-terms/'
|
||||
AND mfr.element = 'title'
|
||||
AND mfr.qualifier IS NULL
|
||||
AND mv.text_value LIKE 'ORIGINAL'
|
||||
AND wfi.owner IS NOT NULL
|
||||
AND (wfi.state = 2 OR wfi.state = 4 OR wfi.state = 6)
|
||||
AND NOT EXISTS(
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 0 AND action_id = 0 AND resourcepolicy.eperson_id = owner AND resourcepolicy.dspace_object = b2b.bitstream_id
|
||||
);
|
||||
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, eperson_id, dspace_object)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL AS policy_id,
|
||||
'0' AS resource_type_id,
|
||||
'1' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
wfi.owner AS eperson_id,
|
||||
b2b.bitstream_id AS dspace_object
|
||||
FROM workflowitem wfi
|
||||
JOIN item2bundle i2b
|
||||
ON i2b.item_id = wfi.item_id
|
||||
JOIN bundle2bitstream b2b
|
||||
ON b2b.bundle_id = i2b.bundle_id
|
||||
JOIN metadatavalue mv
|
||||
ON mv.dspace_object_id = i2b.bundle_id
|
||||
JOIN metadatafieldregistry mfr
|
||||
ON mv.metadata_field_id = mfr.metadata_field_id
|
||||
JOIN metadataschemaregistry msr
|
||||
ON mfr.metadata_schema_id = msr.metadata_schema_id
|
||||
WHERE
|
||||
msr.namespace = 'http://dublincore.org/documents/dcmi-terms/'
|
||||
AND mfr.element = 'title'
|
||||
AND mfr.qualifier IS NULL
|
||||
AND mv.text_value LIKE 'ORIGINAL'
|
||||
AND wfi.owner IS NOT NULL
|
||||
AND (wfi.state = 2 OR wfi.state = 4 OR wfi.state = 6)
|
||||
AND NOT EXISTS(
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 0 AND action_id = 1 AND resourcepolicy.eperson_id = owner AND resourcepolicy.dspace_object = b2b.bitstream_id
|
||||
);
|
||||
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, eperson_id, dspace_object)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL policy_id,
|
||||
'0' AS resource_type_id,
|
||||
'2' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
wfi.owner AS eperson_id,
|
||||
b2b.bitstream_id AS dspace_object
|
||||
FROM workflowitem wfi
|
||||
JOIN item2bundle i2b
|
||||
ON i2b.item_id = wfi.item_id
|
||||
JOIN bundle2bitstream b2b
|
||||
ON b2b.bundle_id = i2b.bundle_id
|
||||
JOIN metadatavalue mv
|
||||
ON mv.dspace_object_id = i2b.bundle_id
|
||||
JOIN metadatafieldregistry mfr
|
||||
ON mv.metadata_field_id = mfr.metadata_field_id
|
||||
JOIN metadataschemaregistry msr
|
||||
ON mfr.metadata_schema_id = msr.metadata_schema_id
|
||||
WHERE
|
||||
msr.namespace = 'http://dublincore.org/documents/dcmi-terms/'
|
||||
AND mfr.element = 'title'
|
||||
AND mfr.qualifier IS NULL
|
||||
AND mv.text_value LIKE 'ORIGINAL'
|
||||
AND wfi.owner IS NOT NULL
|
||||
AND (wfi.state = 2 OR wfi.state = 4 OR wfi.state = 6)
|
||||
AND NOT EXISTS(
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 0 AND action_id = 2 AND resourcepolicy.eperson_id = owner AND resourcepolicy.dspace_object = b2b.bitstream_id
|
||||
);
|
||||
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, eperson_id, dspace_object)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL AS policy_id,
|
||||
'0' AS resource_type_id,
|
||||
'3' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
wfi.owner AS eperson_id,
|
||||
b2b.bitstream_id AS dspace_object
|
||||
FROM workflowitem wfi
|
||||
JOIN item2bundle i2b
|
||||
ON i2b.item_id = wfi.item_id
|
||||
JOIN bundle2bitstream b2b
|
||||
ON b2b.bundle_id = i2b.bundle_id
|
||||
JOIN metadatavalue mv
|
||||
ON mv.dspace_object_id = i2b.bundle_id
|
||||
JOIN metadatafieldregistry mfr
|
||||
ON mv.metadata_field_id = mfr.metadata_field_id
|
||||
JOIN metadataschemaregistry msr
|
||||
ON mfr.metadata_schema_id = msr.metadata_schema_id
|
||||
WHERE
|
||||
msr.namespace = 'http://dublincore.org/documents/dcmi-terms/'
|
||||
AND mfr.element = 'title'
|
||||
AND mfr.qualifier IS NULL
|
||||
AND mv.text_value LIKE 'ORIGINAL'
|
||||
AND wfi.owner IS NOT NULL
|
||||
AND (wfi.state = 2 OR wfi.state = 4 OR wfi.state = 6)
|
||||
AND NOT EXISTS(
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 0 AND action_id = 3 AND resourcepolicy.eperson_id = owner AND resourcepolicy.dspace_object = b2b.bitstream_id
|
||||
);
|
||||
|
||||
INSERT INTO resourcepolicy
|
||||
(policy_id, resource_type_id, action_id, rptype, eperson_id, dspace_object)
|
||||
SELECT
|
||||
resourcepolicy_seq.NEXTVAL AS policy_id,
|
||||
'0' AS resource_type_id,
|
||||
'4' AS action_id,
|
||||
'TYPE_WORKFLOW' AS rptype,
|
||||
wfi.owner AS eperson_id,
|
||||
b2b.bitstream_id AS dspace_object
|
||||
FROM workflowitem wfi
|
||||
JOIN item2bundle i2b
|
||||
ON i2b.item_id = wfi.item_id
|
||||
JOIN bundle2bitstream b2b
|
||||
ON b2b.bundle_id = i2b.bundle_id
|
||||
JOIN metadatavalue mv
|
||||
ON mv.dspace_object_id = i2b.bundle_id
|
||||
JOIN metadatafieldregistry mfr
|
||||
ON mv.metadata_field_id = mfr.metadata_field_id
|
||||
JOIN metadataschemaregistry msr
|
||||
ON mfr.metadata_schema_id = msr.metadata_schema_id
|
||||
WHERE
|
||||
msr.namespace = 'http://dublincore.org/documents/dcmi-terms/'
|
||||
AND mfr.element = 'title'
|
||||
AND mfr.qualifier IS NULL
|
||||
AND mv.text_value LIKE 'ORIGINAL'
|
||||
AND wfi.owner IS NOT NULL
|
||||
AND (wfi.state = 2 OR wfi.state = 4 OR wfi.state = 6)
|
||||
AND NOT EXISTS(
|
||||
SELECT 1 FROM resourcepolicy WHERE resource_type_id = 0 AND action_id = 4 AND resourcepolicy.eperson_id = owner AND resourcepolicy.dspace_object = b2b.bitstream_id
|
||||
);
|
@@ -1,141 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
------------------------------------------------------
|
||||
-- DS-2701 Service based API / Hibernate integration
|
||||
------------------------------------------------------
|
||||
UPDATE collection SET workflow_step_1 = null;
|
||||
UPDATE collection SET workflow_step_2 = null;
|
||||
UPDATE collection SET workflow_step_3 = null;
|
||||
|
||||
-- cwf_workflowitem
|
||||
|
||||
DROP INDEX cwf_workflowitem_coll_fk_idx;
|
||||
|
||||
ALTER TABLE cwf_workflowitem RENAME COLUMN item_id to item_legacy_id;
|
||||
ALTER TABLE cwf_workflowitem ADD item_id RAW(16) REFERENCES Item(uuid);
|
||||
UPDATE cwf_workflowitem SET item_id = (SELECT item.uuid FROM item WHERE cwf_workflowitem.item_legacy_id = item.item_id);
|
||||
ALTER TABLE cwf_workflowitem DROP COLUMN item_legacy_id;
|
||||
|
||||
ALTER TABLE cwf_workflowitem RENAME COLUMN collection_id to collection_legacy_id;
|
||||
ALTER TABLE cwf_workflowitem ADD collection_id RAW(16) REFERENCES Collection(uuid);
|
||||
UPDATE cwf_workflowitem SET collection_id = (SELECT collection.uuid FROM collection WHERE cwf_workflowitem.collection_legacy_id = collection.collection_id);
|
||||
ALTER TABLE cwf_workflowitem DROP COLUMN collection_legacy_id;
|
||||
|
||||
UPDATE cwf_workflowitem SET multiple_titles = '0' WHERE multiple_titles IS NULL;
|
||||
UPDATE cwf_workflowitem SET published_before = '0' WHERE published_before IS NULL;
|
||||
UPDATE cwf_workflowitem SET multiple_files = '0' WHERE multiple_files IS NULL;
|
||||
|
||||
CREATE INDEX cwf_workflowitem_coll_fk_idx ON cwf_workflowitem(collection_id);
|
||||
|
||||
-- cwf_collectionrole
|
||||
|
||||
ALTER TABLE cwf_collectionrole DROP CONSTRAINT cwf_collectionrole_unique;
|
||||
DROP INDEX cwf_cr_coll_role_fk_idx;
|
||||
DROP INDEX cwf_cr_coll_fk_idx;
|
||||
|
||||
ALTER TABLE cwf_collectionrole RENAME COLUMN collection_id to collection_legacy_id;
|
||||
ALTER TABLE cwf_collectionrole ADD collection_id RAW(16) REFERENCES Collection(uuid);
|
||||
UPDATE cwf_collectionrole SET collection_id = (SELECT collection.uuid FROM collection WHERE cwf_collectionrole.collection_legacy_id = collection.collection_id);
|
||||
ALTER TABLE cwf_collectionrole DROP COLUMN collection_legacy_id;
|
||||
|
||||
ALTER TABLE cwf_collectionrole RENAME COLUMN group_id to group_legacy_id;
|
||||
ALTER TABLE cwf_collectionrole ADD group_id RAW(16) REFERENCES epersongroup(uuid);
|
||||
UPDATE cwf_collectionrole SET group_id = (SELECT epersongroup.uuid FROM epersongroup WHERE cwf_collectionrole.group_legacy_id = epersongroup.eperson_group_id);
|
||||
ALTER TABLE cwf_collectionrole DROP COLUMN group_legacy_id;
|
||||
|
||||
ALTER TABLE cwf_collectionrole
|
||||
ADD CONSTRAINT cwf_collectionrole_unique UNIQUE (role_id, collection_id, group_id);
|
||||
|
||||
CREATE INDEX cwf_cr_coll_role_fk_idx ON cwf_collectionrole(collection_id,role_id);
|
||||
CREATE INDEX cwf_cr_coll_fk_idx ON cwf_collectionrole(collection_id);
|
||||
|
||||
|
||||
-- cwf_workflowitemrole
|
||||
|
||||
ALTER TABLE cwf_workflowitemrole DROP CONSTRAINT cwf_workflowitemrole_unique;
|
||||
DROP INDEX cwf_wfir_item_role_fk_idx;
|
||||
DROP INDEX cwf_wfir_item_fk_idx;
|
||||
|
||||
ALTER TABLE cwf_workflowitemrole RENAME COLUMN group_id to group_legacy_id;
|
||||
ALTER TABLE cwf_workflowitemrole ADD group_id RAW(16) REFERENCES epersongroup(uuid);
|
||||
UPDATE cwf_workflowitemrole SET group_id = (SELECT epersongroup.uuid FROM epersongroup WHERE cwf_workflowitemrole.group_legacy_id = epersongroup.eperson_group_id);
|
||||
ALTER TABLE cwf_workflowitemrole DROP COLUMN group_legacy_id;
|
||||
|
||||
ALTER TABLE cwf_workflowitemrole RENAME COLUMN eperson_id to eperson_legacy_id;
|
||||
ALTER TABLE cwf_workflowitemrole ADD eperson_id RAW(16) REFERENCES eperson(uuid);
|
||||
UPDATE cwf_workflowitemrole SET eperson_id = (SELECT eperson.uuid FROM eperson WHERE cwf_workflowitemrole.eperson_legacy_id = eperson.eperson_id);
|
||||
ALTER TABLE cwf_workflowitemrole DROP COLUMN eperson_legacy_id;
|
||||
|
||||
|
||||
ALTER TABLE cwf_workflowitemrole
|
||||
ADD CONSTRAINT cwf_workflowitemrole_unique UNIQUE (role_id, workflowitem_id, eperson_id, group_id);
|
||||
|
||||
CREATE INDEX cwf_wfir_item_role_fk_idx ON cwf_workflowitemrole(workflowitem_id,role_id);
|
||||
CREATE INDEX cwf_wfir_item_fk_idx ON cwf_workflowitemrole(workflowitem_id);
|
||||
|
||||
-- cwf_pooltask
|
||||
|
||||
DROP INDEX cwf_pt_eperson_fk_idx;
|
||||
DROP INDEX cwf_pt_workflow_eperson_fk_idx;
|
||||
|
||||
ALTER TABLE cwf_pooltask RENAME COLUMN group_id to group_legacy_id;
|
||||
ALTER TABLE cwf_pooltask ADD group_id RAW(16) REFERENCES epersongroup(uuid);
|
||||
UPDATE cwf_pooltask SET group_id = (SELECT epersongroup.uuid FROM epersongroup WHERE cwf_pooltask.group_legacy_id = epersongroup.eperson_group_id);
|
||||
ALTER TABLE cwf_pooltask DROP COLUMN group_legacy_id;
|
||||
|
||||
ALTER TABLE cwf_pooltask RENAME COLUMN eperson_id to eperson_legacy_id;
|
||||
ALTER TABLE cwf_pooltask ADD eperson_id RAW(16) REFERENCES eperson(uuid);
|
||||
UPDATE cwf_pooltask SET eperson_id = (SELECT eperson.uuid FROM eperson WHERE cwf_pooltask.eperson_legacy_id = eperson.eperson_id);
|
||||
ALTER TABLE cwf_pooltask DROP COLUMN eperson_legacy_id;
|
||||
|
||||
CREATE INDEX cwf_pt_eperson_fk_idx ON cwf_pooltask(eperson_id);
|
||||
CREATE INDEX cwf_pt_workflow_eperson_fk_idx ON cwf_pooltask(eperson_id,workflowitem_id);
|
||||
|
||||
-- cwf_claimtask
|
||||
|
||||
ALTER TABLE cwf_claimtask DROP CONSTRAINT cwf_claimtask_unique;
|
||||
DROP INDEX cwf_ct_workflow_fk_idx;
|
||||
DROP INDEX cwf_ct_workflow_eperson_fk_idx;
|
||||
DROP INDEX cwf_ct_eperson_fk_idx;
|
||||
DROP INDEX cwf_ct_wfs_fk_idx;
|
||||
DROP INDEX cwf_ct_wfs_action_fk_idx;
|
||||
DROP INDEX cwf_ct_wfs_action_e_fk_idx;
|
||||
|
||||
ALTER TABLE cwf_claimtask RENAME COLUMN owner_id to eperson_legacy_id;
|
||||
ALTER TABLE cwf_claimtask ADD owner_id RAW(16) REFERENCES eperson(uuid);
|
||||
UPDATE cwf_claimtask SET owner_id = (SELECT eperson.uuid FROM eperson WHERE cwf_claimtask.eperson_legacy_id = eperson.eperson_id);
|
||||
ALTER TABLE cwf_claimtask DROP COLUMN eperson_legacy_id;
|
||||
|
||||
ALTER TABLE cwf_claimtask
|
||||
ADD CONSTRAINT cwf_claimtask_unique UNIQUE (step_id, workflowitem_id, workflow_id, owner_id, action_id);
|
||||
|
||||
CREATE INDEX cwf_ct_workflow_fk_idx ON cwf_claimtask(workflowitem_id);
|
||||
CREATE INDEX cwf_ct_workflow_eperson_fk_idx ON cwf_claimtask(workflowitem_id,owner_id);
|
||||
CREATE INDEX cwf_ct_eperson_fk_idx ON cwf_claimtask(owner_id);
|
||||
CREATE INDEX cwf_ct_wfs_fk_idx ON cwf_claimtask(workflowitem_id,step_id);
|
||||
CREATE INDEX cwf_ct_wfs_action_fk_idx ON cwf_claimtask(workflowitem_id,step_id,action_id);
|
||||
CREATE INDEX cwf_ct_wfs_action_e_fk_idx ON cwf_claimtask(workflowitem_id,step_id,action_id,owner_id);
|
||||
|
||||
-- cwf_in_progress_user
|
||||
|
||||
ALTER TABLE cwf_in_progress_user DROP CONSTRAINT cwf_in_progress_user_unique;
|
||||
DROP INDEX cwf_ipu_workflow_fk_idx;
|
||||
DROP INDEX cwf_ipu_eperson_fk_idx;
|
||||
|
||||
ALTER TABLE cwf_in_progress_user RENAME COLUMN user_id to eperson_legacy_id;
|
||||
ALTER TABLE cwf_in_progress_user ADD user_id RAW(16) REFERENCES eperson(uuid);
|
||||
UPDATE cwf_in_progress_user SET user_id = (SELECT eperson.uuid FROM eperson WHERE cwf_in_progress_user.eperson_legacy_id = eperson.eperson_id);
|
||||
ALTER TABLE cwf_in_progress_user DROP COLUMN eperson_legacy_id;
|
||||
UPDATE cwf_in_progress_user SET finished = '0' WHERE finished IS NULL;
|
||||
|
||||
ALTER TABLE cwf_in_progress_user
|
||||
ADD CONSTRAINT cwf_in_progress_user_unique UNIQUE (workflowitem_id, user_id);
|
||||
|
||||
CREATE INDEX cwf_ipu_workflow_fk_idx ON cwf_in_progress_user(workflowitem_id);
|
||||
CREATE INDEX cwf_ipu_eperson_fk_idx ON cwf_in_progress_user(user_id);
|
@@ -1,27 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-- UPDATE policies for claimtasks
|
||||
-- Item
|
||||
UPDATE RESOURCEPOLICY SET rptype = 'TYPE_WORKFLOW' WHERE dspace_object in (SELECT cwf_workflowitem.item_id FROM cwf_workflowitem INNER JOIN cwf_claimtask ON cwf_workflowitem.workflowitem_id = cwf_claimtask.workflowitem_id JOIN item ON cwf_workflowitem.item_id = item.uuid) AND eperson_id not in (SELECT item.submitter_id FROM cwf_workflowitem JOIN item ON cwf_workflowitem.item_id = item.uuid);
|
||||
|
||||
-- Bundles
|
||||
UPDATE RESOURCEPOLICY SET rptype = 'TYPE_WORKFLOW' WHERE dspace_object in (SELECT item2bundle.bundle_id FROM cwf_workflowitem INNER JOIN cwf_claimtask ON cwf_workflowitem.workflowitem_id = cwf_claimtask.workflowitem_id INNER JOIN item2bundle ON cwf_workflowitem.item_id = item2bundle.item_id) AND eperson_id not in (SELECT item.submitter_id FROM cwf_workflowitem JOIN item ON cwf_workflowitem.item_id = item.uuid);
|
||||
|
||||
-- Bitstreams
|
||||
UPDATE RESOURCEPOLICY SET rptype = 'TYPE_WORKFLOW' WHERE dspace_object in (SELECT bundle2bitstream.bitstream_id FROM cwf_workflowitem INNER JOIN cwf_claimtask ON cwf_workflowitem.workflowitem_id = cwf_claimtask.workflowitem_id INNER JOIN item2bundle ON cwf_workflowitem.item_id = item2bundle.item_id INNER JOIN bundle2bitstream ON item2bundle.bundle_id = bundle2bitstream.bundle_id) AND eperson_id not in (SELECT item.submitter_id FROM cwf_workflowitem JOIN item ON cwf_workflowitem.item_id = item.uuid);
|
||||
|
||||
-- Create policies for pooled tasks
|
||||
-- Item
|
||||
UPDATE RESOURCEPOLICY SET rptype = 'TYPE_WORKFLOW' WHERE dspace_object in (SELECT cwf_workflowitem.item_id FROM cwf_workflowitem INNER JOIN cwf_pooltask ON cwf_workflowitem.workflowitem_id = cwf_pooltask.workflowitem_id) AND eperson_id not in (SELECT item.submitter_id FROM cwf_workflowitem JOIN item ON cwf_workflowitem.item_id = item.uuid);
|
||||
|
||||
-- Bundles
|
||||
UPDATE RESOURCEPOLICY SET rptype = 'TYPE_WORKFLOW' WHERE dspace_object in (SELECT cwf_workflowitem.item_id FROM cwf_workflowitem INNER JOIN cwf_pooltask ON cwf_workflowitem.workflowitem_id = cwf_pooltask.workflowitem_id INNER JOIN item2bundle ON cwf_workflowitem.item_id = item2bundle.item_id) AND eperson_id not in (SELECT item.submitter_id FROM cwf_workflowitem JOIN item ON cwf_workflowitem.item_id = item.uuid);
|
||||
|
||||
-- Bitstreams
|
||||
UPDATE RESOURCEPOLICY SET rptype = 'TYPE_WORKFLOW' WHERE dspace_object in (SELECT cwf_workflowitem.item_id FROM cwf_workflowitem INNER JOIN cwf_pooltask ON cwf_workflowitem.workflowitem_id = cwf_pooltask.workflowitem_id INNER JOIN item2bundle ON cwf_workflowitem.item_id = item2bundle.item_id INNER JOIN bundle2bitstream ON item2bundle.bundle_id = bundle2bitstream.bundle_id) AND eperson_id not in (SELECT item.submitter_id FROM cwf_workflowitem JOIN item ON cwf_workflowitem.item_id = item.uuid);
|
@@ -1,377 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
----------------------------------------------------
|
||||
-- Data Migration for XML/Configurable Workflow
|
||||
--
|
||||
-- This file will automatically migrate existing
|
||||
-- classic workflows to XML/Configurable workflows.
|
||||
-- NOTE however that the corresponding
|
||||
-- "xml_workflow_migration.sql" script must FIRST be
|
||||
-- called to create the appropriate database tables.
|
||||
--
|
||||
-- This script is called automatically by the following
|
||||
-- Flyway Java migration class:
|
||||
-- org.dspace.storage.rdbms.migration.V5_0_2014_01_01__XMLWorkflow_Migration
|
||||
----------------------------------------------------
|
||||
|
||||
-- Convert workflow groups:
|
||||
-- TODO: is 'to_number' ok? do not forget to change role_id values
|
||||
|
||||
INSERT INTO cwf_collectionrole (collectionrole_id, role_id, group_id, collection_id)
|
||||
SELECT
|
||||
cwf_collectionrole_seq.nextval as collectionrole_id,
|
||||
'reviewer' AS role_id,
|
||||
collection.workflow_step_1 AS group_id,
|
||||
collection.collection_id AS collection_id
|
||||
FROM collection
|
||||
WHERE collection.workflow_step_1 IS NOT NULL;
|
||||
|
||||
INSERT INTO cwf_collectionrole (collectionrole_id, role_id, group_id, collection_id)
|
||||
SELECT
|
||||
cwf_collectionrole_seq.nextval as collectionrole_id,
|
||||
'editor' AS role_id,
|
||||
collection.workflow_step_2 AS group_id,
|
||||
collection.collection_id AS collection_id
|
||||
FROM collection
|
||||
WHERE collection.workflow_step_2 IS NOT NULL;
|
||||
|
||||
INSERT INTO cwf_collectionrole (collectionrole_id, role_id, group_id, collection_id)
|
||||
SELECT
|
||||
cwf_collectionrole_seq.nextval as collectionrole_id,
|
||||
'finaleditor' AS role_id,
|
||||
collection.workflow_step_3 AS group_id,
|
||||
collection.collection_id AS collection_id
|
||||
FROM collection
|
||||
WHERE collection.workflow_step_3 IS NOT NULL;
|
||||
|
||||
|
||||
-- Migrate workflow items
|
||||
INSERT INTO cwf_workflowitem (workflowitem_id, item_id, collection_id, multiple_titles, published_before, multiple_files)
|
||||
SELECT
|
||||
workflow_id AS workflowitem_id,
|
||||
item_id,
|
||||
collection_id,
|
||||
multiple_titles,
|
||||
published_before,
|
||||
multiple_files
|
||||
FROM workflowitem;
|
||||
|
||||
|
||||
-- Migrate claimed tasks
|
||||
INSERT INTO cwf_claimtask (claimtask_id,workflowitem_id, workflow_id, step_id, action_id, owner_id)
|
||||
SELECT
|
||||
cwf_claimtask_seq.nextval AS claimtask_id,
|
||||
workflow_id AS workflowitem_id,
|
||||
'default' AS workflow_id,
|
||||
'reviewstep' AS step_id,
|
||||
'reviewaction' AS action_id,
|
||||
owner AS owner_id
|
||||
FROM workflowitem WHERE owner IS NOT NULL AND state = 2;
|
||||
|
||||
INSERT INTO cwf_claimtask (claimtask_id,workflowitem_id, workflow_id, step_id, action_id, owner_id)
|
||||
SELECT
|
||||
cwf_claimtask_seq.nextval AS claimtask_id,
|
||||
workflow_id AS workflowitem_id,
|
||||
'default' AS workflow_id,
|
||||
'editstep' AS step_id,
|
||||
'editaction' AS action_id,
|
||||
owner AS owner_id
|
||||
FROM workflowitem WHERE owner IS NOT NULL AND state = 4;
|
||||
|
||||
INSERT INTO cwf_claimtask (claimtask_id,workflowitem_id, workflow_id, step_id, action_id, owner_id)
|
||||
SELECT
|
||||
cwf_claimtask_seq.nextval AS claimtask_id,
|
||||
workflow_id AS workflowitem_id,
|
||||
'default' AS workflow_id,
|
||||
'finaleditstep' AS step_id,
|
||||
'finaleditaction' AS action_id,
|
||||
owner AS owner_id
|
||||
FROM workflowitem WHERE owner IS NOT NULL AND state = 6;
|
||||
|
||||
|
||||
-- Migrate pooled tasks
|
||||
INSERT INTO cwf_pooltask (pooltask_id,workflowitem_id, workflow_id, step_id, action_id, group_id)
|
||||
SELECT
|
||||
cwf_pooltask_seq.nextval AS pooltask_id,
|
||||
workflowitem.workflow_id AS workflowitem_id,
|
||||
'default' AS workflow_id,
|
||||
'reviewstep' AS step_id,
|
||||
'claimaction' AS action_id,
|
||||
cwf_collectionrole.group_id AS group_id
|
||||
FROM workflowitem INNER JOIN cwf_collectionrole ON workflowitem.collection_id = cwf_collectionrole.collection_id
|
||||
WHERE workflowitem.owner IS NULL AND workflowitem.state = 1 AND cwf_collectionrole.role_id = 'reviewer';
|
||||
|
||||
INSERT INTO cwf_pooltask (pooltask_id,workflowitem_id, workflow_id, step_id, action_id, group_id)
|
||||
SELECT
|
||||
cwf_pooltask_seq.nextval AS pooltask_id,
|
||||
workflowitem.workflow_id AS workflowitem_id,
|
||||
'default' AS workflow_id,
|
||||
'editstep' AS step_id,
|
||||
'claimaction' AS action_id,
|
||||
cwf_collectionrole.group_id AS group_id
|
||||
FROM workflowitem INNER JOIN cwf_collectionrole ON workflowitem.collection_id = cwf_collectionrole.collection_id
|
||||
WHERE workflowitem.owner IS NULL AND workflowitem.state = 3 AND cwf_collectionrole.role_id = 'editor';
|
||||
|
||||
INSERT INTO cwf_pooltask (pooltask_id,workflowitem_id, workflow_id, step_id, action_id, group_id)
|
||||
SELECT
|
||||
cwf_pooltask_seq.nextval AS pooltask_id,
|
||||
workflowitem.workflow_id AS workflowitem_id,
|
||||
'default' AS workflow_id,
|
||||
'finaleditstep' AS step_id,
|
||||
'claimaction' AS action_id,
|
||||
cwf_collectionrole.group_id AS group_id
|
||||
FROM workflowitem INNER JOIN cwf_collectionrole ON workflowitem.collection_id = cwf_collectionrole.collection_id
|
||||
WHERE workflowitem.owner IS NULL AND workflowitem.state = 5 AND cwf_collectionrole.role_id = 'finaleditor';
|
||||
|
||||
-- Delete resource policies for workflowitems before creating new ones
|
||||
DELETE FROM resourcepolicy
|
||||
WHERE resource_type_id = 2 AND resource_id IN
|
||||
(SELECT item_id FROM workflowitem);
|
||||
|
||||
DELETE FROM resourcepolicy
|
||||
WHERE resource_type_id = 1 AND resource_id IN
|
||||
(SELECT item2bundle.bundle_id FROM
|
||||
(workflowitem INNER JOIN item2bundle ON workflowitem.item_id = item2bundle.item_id));
|
||||
|
||||
DELETE FROM resourcepolicy
|
||||
WHERE resource_type_id = 0 AND resource_id IN
|
||||
(SELECT bundle2bitstream.bitstream_id FROM
|
||||
((workflowitem INNER JOIN item2bundle ON workflowitem.item_id = item2bundle.item_id)
|
||||
INNER JOIN bundle2bitstream ON item2bundle.bundle_id = bundle2bitstream.bundle_id));
|
||||
-- Create policies for claimtasks
|
||||
-- public static final int BITSTREAM = 0;
|
||||
-- public static final int BUNDLE = 1;
|
||||
-- public static final int ITEM = 2;
|
||||
|
||||
-- public static final int READ = 0;
|
||||
-- public static final int WRITE = 1;
|
||||
-- public static final int DELETE = 2;
|
||||
-- public static final int ADD = 3;
|
||||
-- public static final int REMOVE = 4;
|
||||
-- Item
|
||||
-- TODO: getnextID == SELECT sequence.nextval FROM DUAL!!
|
||||
-- Create a temporarty table with action ID's
|
||||
CREATE TABLE temptable(
|
||||
action_id INTEGER PRIMARY KEY
|
||||
);
|
||||
INSERT ALL
|
||||
INTO temptable (action_id) VALUES (0)
|
||||
INTO temptable (action_id) VALUES (1)
|
||||
INTO temptable (action_id) VALUES (2)
|
||||
INTO temptable (action_id) VALUES (3)
|
||||
INTO temptable (action_id) VALUES (4)
|
||||
SELECT * FROM DUAL;
|
||||
|
||||
INSERT INTO resourcepolicy (policy_id, resource_type_id, resource_id, action_id, eperson_id)
|
||||
SELECT
|
||||
resourcepolicy_seq.nextval AS policy_id,
|
||||
2 AS resource_type_id,
|
||||
cwf_workflowitem.item_id AS resource_id,
|
||||
temptable.action_id AS action_id,
|
||||
cwf_claimtask.owner_id AS eperson_id
|
||||
FROM (cwf_workflowitem INNER JOIN cwf_claimtask ON cwf_workflowitem.workflowitem_id = cwf_claimtask.workflowitem_id),
|
||||
temptable;
|
||||
|
||||
-- Bundles
|
||||
INSERT INTO resourcepolicy (policy_id, resource_type_id, resource_id, action_id, eperson_id)
|
||||
SELECT
|
||||
resourcepolicy_seq.nextval AS policy_id,
|
||||
1 AS resource_type_id,
|
||||
item2bundle.bundle_id AS resource_id,
|
||||
temptable.action_id AS action_id,
|
||||
cwf_claimtask.owner_id AS eperson_id
|
||||
FROM
|
||||
(
|
||||
(cwf_workflowitem INNER JOIN cwf_claimtask ON cwf_workflowitem.workflowitem_id = cwf_claimtask.workflowitem_id)
|
||||
INNER JOIN item2bundle ON cwf_workflowitem.item_id = item2bundle.item_id
|
||||
), temptable;
|
||||
|
||||
|
||||
-- Bitstreams
|
||||
INSERT INTO resourcepolicy (policy_id, resource_type_id, resource_id, action_id, eperson_id)
|
||||
SELECT
|
||||
resourcepolicy_seq.nextval AS policy_id,
|
||||
0 AS resource_type_id,
|
||||
bundle2bitstream.bitstream_id AS resource_id,
|
||||
temptable.action_id AS action_id,
|
||||
cwf_claimtask.owner_id AS eperson_id
|
||||
FROM
|
||||
(
|
||||
((cwf_workflowitem INNER JOIN cwf_claimtask ON cwf_workflowitem.workflowitem_id = cwf_claimtask.workflowitem_id)
|
||||
INNER JOIN item2bundle ON cwf_workflowitem.item_id = item2bundle.item_id)
|
||||
INNER JOIN bundle2bitstream ON item2bundle.bundle_id = bundle2bitstream.bundle_id
|
||||
), temptable;
|
||||
|
||||
|
||||
-- Create policies for pooled tasks
|
||||
|
||||
INSERT INTO resourcepolicy (policy_id, resource_type_id, resource_id, action_id, epersongroup_id)
|
||||
SELECT
|
||||
resourcepolicy_seq.nextval AS policy_id,
|
||||
2 AS resource_type_id,
|
||||
cwf_workflowitem.item_id AS resource_id,
|
||||
temptable.action_id AS action_id,
|
||||
cwf_pooltask.group_id AS epersongroup_id
|
||||
FROM (cwf_workflowitem INNER JOIN cwf_pooltask ON cwf_workflowitem.workflowitem_id = cwf_pooltask.workflowitem_id),
|
||||
temptable;
|
||||
|
||||
-- Bundles
|
||||
INSERT INTO resourcepolicy (policy_id, resource_type_id, resource_id, action_id, epersongroup_id)
|
||||
SELECT
|
||||
resourcepolicy_seq.nextval AS policy_id,
|
||||
1 AS resource_type_id,
|
||||
item2bundle.bundle_id AS resource_id,
|
||||
temptable.action_id AS action_id,
|
||||
cwf_pooltask.group_id AS epersongroup_id
|
||||
FROM
|
||||
(
|
||||
(cwf_workflowitem INNER JOIN cwf_pooltask ON cwf_workflowitem.workflowitem_id = cwf_pooltask.workflowitem_id)
|
||||
INNER JOIN item2bundle ON cwf_workflowitem.item_id = item2bundle.item_id
|
||||
), temptable;
|
||||
|
||||
-- Bitstreams
|
||||
INSERT INTO resourcepolicy (policy_id, resource_type_id, resource_id, action_id, epersongroup_id)
|
||||
SELECT
|
||||
resourcepolicy_seq.nextval AS policy_id,
|
||||
0 AS resource_type_id,
|
||||
bundle2bitstream.bitstream_id AS resource_id,
|
||||
temptable.action_id AS action_id,
|
||||
cwf_pooltask.group_id AS epersongroup_id
|
||||
FROM
|
||||
(
|
||||
((cwf_workflowitem INNER JOIN cwf_pooltask ON cwf_workflowitem.workflowitem_id = cwf_pooltask.workflowitem_id)
|
||||
INNER JOIN item2bundle ON cwf_workflowitem.item_id = item2bundle.item_id)
|
||||
INNER JOIN bundle2bitstream ON item2bundle.bundle_id = bundle2bitstream.bundle_id
|
||||
), temptable;
|
||||
|
||||
-- Drop the temporary table with the action ID's
|
||||
DROP TABLE temptable;
|
||||
|
||||
-- Create policies for submitter
|
||||
-- TODO: only add if unique
|
||||
INSERT INTO resourcepolicy (policy_id, resource_type_id, resource_id, action_id, eperson_id)
|
||||
SELECT
|
||||
resourcepolicy_seq.nextval AS policy_id,
|
||||
2 AS resource_type_id,
|
||||
cwf_workflowitem.item_id AS resource_id,
|
||||
0 AS action_id,
|
||||
item.submitter_id AS eperson_id
|
||||
FROM (cwf_workflowitem INNER JOIN item ON cwf_workflowitem.item_id = item.item_id);
|
||||
|
||||
INSERT INTO resourcepolicy (policy_id, resource_type_id, resource_id, action_id, eperson_id)
|
||||
SELECT
|
||||
resourcepolicy_seq.nextval AS policy_id,
|
||||
1 AS resource_type_id,
|
||||
item2bundle.bundle_id AS resource_id,
|
||||
0 AS action_id,
|
||||
item.submitter_id AS eperson_id
|
||||
FROM ((cwf_workflowitem INNER JOIN item ON cwf_workflowitem.item_id = item.item_id)
|
||||
INNER JOIN item2bundle ON cwf_workflowitem.item_id = item2bundle.item_id
|
||||
);
|
||||
|
||||
INSERT INTO resourcepolicy (policy_id, resource_type_id, resource_id, action_id, eperson_id)
|
||||
SELECT
|
||||
resourcepolicy_seq.nextval AS policy_id,
|
||||
0 AS resource_type_id,
|
||||
bundle2bitstream.bitstream_id AS resource_id,
|
||||
0 AS action_id,
|
||||
item.submitter_id AS eperson_id
|
||||
FROM (((cwf_workflowitem INNER JOIN item ON cwf_workflowitem.item_id = item.item_id)
|
||||
INNER JOIN item2bundle ON cwf_workflowitem.item_id = item2bundle.item_id)
|
||||
INNER JOIN bundle2bitstream ON item2bundle.bundle_id = bundle2bitstream.bundle_id
|
||||
);
|
||||
|
||||
-- TODO: not tested yet
|
||||
INSERT INTO cwf_in_progress_user (in_progress_user_id, workflowitem_id, user_id, finished)
|
||||
SELECT
|
||||
cwf_in_progress_user_seq.nextval AS in_progress_user_id,
|
||||
cwf_workflowitem.workflowitem_id AS workflowitem_id,
|
||||
cwf_claimtask.owner_id AS user_id,
|
||||
0 as finished
|
||||
FROM
|
||||
(cwf_claimtask INNER JOIN cwf_workflowitem ON cwf_workflowitem.workflowitem_id = cwf_claimtask.workflowitem_id);
|
||||
|
||||
-- TODO: improve this, important is NVL(curr, 1)!! without this function, empty tables (max = [null]) will only result in sequence deletion
|
||||
DECLARE
|
||||
curr NUMBER := 0;
|
||||
BEGIN
|
||||
SELECT max(workflowitem_id) INTO curr FROM cwf_workflowitem;
|
||||
|
||||
curr := curr + 1;
|
||||
|
||||
EXECUTE IMMEDIATE 'DROP SEQUENCE cwf_workflowitem_seq';
|
||||
|
||||
EXECUTE IMMEDIATE 'CREATE SEQUENCE cwf_workflowitem_seq START WITH ' || NVL(curr, 1);
|
||||
END;
|
||||
/
|
||||
|
||||
DECLARE
|
||||
curr NUMBER := 0;
|
||||
BEGIN
|
||||
SELECT max(collectionrole_id) INTO curr FROM cwf_collectionrole;
|
||||
|
||||
curr := curr + 1;
|
||||
|
||||
EXECUTE IMMEDIATE 'DROP SEQUENCE cwf_collectionrole_seq';
|
||||
|
||||
EXECUTE IMMEDIATE 'CREATE SEQUENCE cwf_collectionrole_seq START WITH ' || NVL(curr, 1);
|
||||
END;
|
||||
/
|
||||
|
||||
DECLARE
|
||||
curr NUMBER := 0;
|
||||
BEGIN
|
||||
SELECT max(workflowitemrole_id) INTO curr FROM cwf_workflowitemrole;
|
||||
|
||||
curr := curr + 1;
|
||||
|
||||
EXECUTE IMMEDIATE 'DROP SEQUENCE cwf_workflowitemrole_seq';
|
||||
|
||||
EXECUTE IMMEDIATE 'CREATE SEQUENCE cwf_workflowitemrole_seq START WITH ' || NVL(curr, 1);
|
||||
END;
|
||||
/
|
||||
|
||||
DECLARE
|
||||
curr NUMBER := 0;
|
||||
BEGIN
|
||||
SELECT max(pooltask_id) INTO curr FROM cwf_pooltask;
|
||||
|
||||
curr := curr + 1;
|
||||
|
||||
EXECUTE IMMEDIATE 'DROP SEQUENCE cwf_pooltask_seq';
|
||||
|
||||
EXECUTE IMMEDIATE 'CREATE SEQUENCE cwf_pooltask_seq START WITH ' || NVL(curr, 1);
|
||||
END;
|
||||
/
|
||||
|
||||
DECLARE
|
||||
curr NUMBER := 0;
|
||||
BEGIN
|
||||
SELECT max(claimtask_id) INTO curr FROM cwf_claimtask;
|
||||
|
||||
curr := curr + 1;
|
||||
|
||||
EXECUTE IMMEDIATE 'DROP SEQUENCE cwf_claimtask_seq';
|
||||
|
||||
EXECUTE IMMEDIATE 'CREATE SEQUENCE cwf_claimtask_seq START WITH ' || NVL(curr, 1);
|
||||
END;
|
||||
/
|
||||
|
||||
DECLARE
|
||||
curr NUMBER := 0;
|
||||
BEGIN
|
||||
SELECT max(in_progress_user_id) INTO curr FROM cwf_in_progress_user;
|
||||
|
||||
curr := curr + 1;
|
||||
|
||||
EXECUTE IMMEDIATE 'DROP SEQUENCE cwf_in_progress_user_seq';
|
||||
|
||||
EXECUTE IMMEDIATE 'CREATE SEQUENCE cwf_in_progress_user_seq START WITH ' || NVL(curr, 1);
|
||||
END;
|
||||
/
|
@@ -1,377 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
----------------------------------------------------
|
||||
-- Data Migration for XML/Configurable Workflow
|
||||
--
|
||||
-- This file will automatically migrate existing
|
||||
-- classic workflows to XML/Configurable workflows.
|
||||
-- NOTE however that the corresponding
|
||||
-- "xml_workflow_migration.sql" script must FIRST be
|
||||
-- called to create the appropriate database tables.
|
||||
--
|
||||
-- This script is called automatically by the following
|
||||
-- Flyway Java migration class:
|
||||
-- org.dspace.storage.rdbms.xmlworkflow.V6_0_2015_09_01__DS_2701_Enable_XMLWorkflow_Migration
|
||||
----------------------------------------------------
|
||||
|
||||
-- Convert workflow groups:
|
||||
-- TODO: is 'to_number' ok? do not forget to change role_id values
|
||||
|
||||
INSERT INTO cwf_collectionrole (collectionrole_id, role_id, group_id, collection_id)
|
||||
SELECT
|
||||
cwf_collectionrole_seq.nextval as collectionrole_id,
|
||||
'reviewer' AS role_id,
|
||||
collection.workflow_step_1 AS group_id,
|
||||
collection.uuid AS collection_id
|
||||
FROM collection
|
||||
WHERE collection.workflow_step_1 IS NOT NULL;
|
||||
|
||||
INSERT INTO cwf_collectionrole (collectionrole_id, role_id, group_id, collection_id)
|
||||
SELECT
|
||||
cwf_collectionrole_seq.nextval as collectionrole_id,
|
||||
'editor' AS role_id,
|
||||
collection.workflow_step_2 AS group_id,
|
||||
collection.uuid AS collection_id
|
||||
FROM collection
|
||||
WHERE collection.workflow_step_2 IS NOT NULL;
|
||||
|
||||
INSERT INTO cwf_collectionrole (collectionrole_id, role_id, group_id, collection_id)
|
||||
SELECT
|
||||
cwf_collectionrole_seq.nextval as collectionrole_id,
|
||||
'finaleditor' AS role_id,
|
||||
collection.workflow_step_3 AS group_id,
|
||||
collection.uuid AS collection_id
|
||||
FROM collection
|
||||
WHERE collection.workflow_step_3 IS NOT NULL;
|
||||
|
||||
|
||||
-- Migrate workflow items
|
||||
INSERT INTO cwf_workflowitem (workflowitem_id, item_id, collection_id, multiple_titles, published_before, multiple_files)
|
||||
SELECT
|
||||
workflow_id AS workflowitem_id,
|
||||
item_id,
|
||||
collection_id,
|
||||
multiple_titles,
|
||||
published_before,
|
||||
multiple_files
|
||||
FROM workflowitem;
|
||||
|
||||
|
||||
-- Migrate claimed tasks
|
||||
INSERT INTO cwf_claimtask (claimtask_id,workflowitem_id, workflow_id, step_id, action_id, owner_id)
|
||||
SELECT
|
||||
cwf_claimtask_seq.nextval AS claimtask_id,
|
||||
workflow_id AS workflowitem_id,
|
||||
'default' AS workflow_id,
|
||||
'reviewstep' AS step_id,
|
||||
'reviewaction' AS action_id,
|
||||
owner AS owner_id
|
||||
FROM workflowitem WHERE owner IS NOT NULL AND state = 2;
|
||||
|
||||
INSERT INTO cwf_claimtask (claimtask_id,workflowitem_id, workflow_id, step_id, action_id, owner_id)
|
||||
SELECT
|
||||
cwf_claimtask_seq.nextval AS claimtask_id,
|
||||
workflow_id AS workflowitem_id,
|
||||
'default' AS workflow_id,
|
||||
'editstep' AS step_id,
|
||||
'editaction' AS action_id,
|
||||
owner AS owner_id
|
||||
FROM workflowitem WHERE owner IS NOT NULL AND state = 4;
|
||||
|
||||
INSERT INTO cwf_claimtask (claimtask_id,workflowitem_id, workflow_id, step_id, action_id, owner_id)
|
||||
SELECT
|
||||
cwf_claimtask_seq.nextval AS claimtask_id,
|
||||
workflow_id AS workflowitem_id,
|
||||
'default' AS workflow_id,
|
||||
'finaleditstep' AS step_id,
|
||||
'finaleditaction' AS action_id,
|
||||
owner AS owner_id
|
||||
FROM workflowitem WHERE owner IS NOT NULL AND state = 6;
|
||||
|
||||
|
||||
-- Migrate pooled tasks
|
||||
INSERT INTO cwf_pooltask (pooltask_id,workflowitem_id, workflow_id, step_id, action_id, group_id)
|
||||
SELECT
|
||||
cwf_pooltask_seq.nextval AS pooltask_id,
|
||||
workflowitem.workflow_id AS workflowitem_id,
|
||||
'default' AS workflow_id,
|
||||
'reviewstep' AS step_id,
|
||||
'claimaction' AS action_id,
|
||||
cwf_collectionrole.group_id AS group_id
|
||||
FROM workflowitem INNER JOIN cwf_collectionrole ON workflowitem.collection_id = cwf_collectionrole.collection_id
|
||||
WHERE workflowitem.owner IS NULL AND workflowitem.state = 1 AND cwf_collectionrole.role_id = 'reviewer';
|
||||
|
||||
INSERT INTO cwf_pooltask (pooltask_id,workflowitem_id, workflow_id, step_id, action_id, group_id)
|
||||
SELECT
|
||||
cwf_pooltask_seq.nextval AS pooltask_id,
|
||||
workflowitem.workflow_id AS workflowitem_id,
|
||||
'default' AS workflow_id,
|
||||
'editstep' AS step_id,
|
||||
'claimaction' AS action_id,
|
||||
cwf_collectionrole.group_id AS group_id
|
||||
FROM workflowitem INNER JOIN cwf_collectionrole ON workflowitem.collection_id = cwf_collectionrole.collection_id
|
||||
WHERE workflowitem.owner IS NULL AND workflowitem.state = 3 AND cwf_collectionrole.role_id = 'editor';
|
||||
|
||||
INSERT INTO cwf_pooltask (pooltask_id,workflowitem_id, workflow_id, step_id, action_id, group_id)
|
||||
SELECT
|
||||
cwf_pooltask_seq.nextval AS pooltask_id,
|
||||
workflowitem.workflow_id AS workflowitem_id,
|
||||
'default' AS workflow_id,
|
||||
'finaleditstep' AS step_id,
|
||||
'claimaction' AS action_id,
|
||||
cwf_collectionrole.group_id AS group_id
|
||||
FROM workflowitem INNER JOIN cwf_collectionrole ON workflowitem.collection_id = cwf_collectionrole.collection_id
|
||||
WHERE workflowitem.owner IS NULL AND workflowitem.state = 5 AND cwf_collectionrole.role_id = 'finaleditor';
|
||||
|
||||
-- Delete resource policies for workflowitems before creating new ones
|
||||
DELETE FROM resourcepolicy
|
||||
WHERE dspace_object IN
|
||||
(SELECT item_id FROM workflowitem);
|
||||
|
||||
DELETE FROM resourcepolicy
|
||||
WHERE dspace_object IN
|
||||
(SELECT item2bundle.bundle_id FROM
|
||||
(workflowitem INNER JOIN item2bundle ON workflowitem.item_id = item2bundle.item_id));
|
||||
|
||||
DELETE FROM resourcepolicy
|
||||
WHERE dspace_object IN
|
||||
(SELECT bundle2bitstream.bitstream_id FROM
|
||||
((workflowitem INNER JOIN item2bundle ON workflowitem.item_id = item2bundle.item_id)
|
||||
INNER JOIN bundle2bitstream ON item2bundle.bundle_id = bundle2bitstream.bundle_id));
|
||||
-- Create policies for claimtasks
|
||||
-- public static final int BITSTREAM = 0;
|
||||
-- public static final int BUNDLE = 1;
|
||||
-- public static final int ITEM = 2;
|
||||
|
||||
-- public static final int READ = 0;
|
||||
-- public static final int WRITE = 1;
|
||||
-- public static final int DELETE = 2;
|
||||
-- public static final int ADD = 3;
|
||||
-- public static final int REMOVE = 4;
|
||||
-- Item
|
||||
-- TODO: getnextID == SELECT sequence.nextval FROM DUAL!!
|
||||
-- Create a temporarty table with action ID's
|
||||
CREATE TABLE temptable(
|
||||
action_id INTEGER PRIMARY KEY
|
||||
);
|
||||
INSERT ALL
|
||||
INTO temptable (action_id) VALUES (0)
|
||||
INTO temptable (action_id) VALUES (1)
|
||||
INTO temptable (action_id) VALUES (2)
|
||||
INTO temptable (action_id) VALUES (3)
|
||||
INTO temptable (action_id) VALUES (4)
|
||||
SELECT * FROM DUAL;
|
||||
|
||||
INSERT INTO resourcepolicy (policy_id, resource_type_id, dspace_object, action_id, eperson_id)
|
||||
SELECT
|
||||
resourcepolicy_seq.nextval AS policy_id,
|
||||
2 AS resource_type_id,
|
||||
cwf_workflowitem.item_id AS dspace_object,
|
||||
temptable.action_id AS action_id,
|
||||
cwf_claimtask.owner_id AS eperson_id
|
||||
FROM (cwf_workflowitem INNER JOIN cwf_claimtask ON cwf_workflowitem.workflowitem_id = cwf_claimtask.workflowitem_id),
|
||||
temptable;
|
||||
|
||||
-- Bundles
|
||||
INSERT INTO resourcepolicy (policy_id, resource_type_id, dspace_object, action_id, eperson_id)
|
||||
SELECT
|
||||
resourcepolicy_seq.nextval AS policy_id,
|
||||
1 AS resource_type_id,
|
||||
item2bundle.bundle_id AS dspace_object,
|
||||
temptable.action_id AS action_id,
|
||||
cwf_claimtask.owner_id AS eperson_id
|
||||
FROM
|
||||
(
|
||||
(cwf_workflowitem INNER JOIN cwf_claimtask ON cwf_workflowitem.workflowitem_id = cwf_claimtask.workflowitem_id)
|
||||
INNER JOIN item2bundle ON cwf_workflowitem.item_id = item2bundle.item_id
|
||||
), temptable;
|
||||
|
||||
|
||||
-- Bitstreams
|
||||
INSERT INTO resourcepolicy (policy_id, resource_type_id, dspace_object, action_id, eperson_id)
|
||||
SELECT
|
||||
resourcepolicy_seq.nextval AS policy_id,
|
||||
0 AS resource_type_id,
|
||||
bundle2bitstream.bitstream_id AS dspace_object,
|
||||
temptable.action_id AS action_id,
|
||||
cwf_claimtask.owner_id AS eperson_id
|
||||
FROM
|
||||
(
|
||||
((cwf_workflowitem INNER JOIN cwf_claimtask ON cwf_workflowitem.workflowitem_id = cwf_claimtask.workflowitem_id)
|
||||
INNER JOIN item2bundle ON cwf_workflowitem.item_id = item2bundle.item_id)
|
||||
INNER JOIN bundle2bitstream ON item2bundle.bundle_id = bundle2bitstream.bundle_id
|
||||
), temptable;
|
||||
|
||||
|
||||
-- Create policies for pooled tasks
|
||||
|
||||
INSERT INTO resourcepolicy (policy_id, resource_type_id, dspace_object, action_id, epersongroup_id)
|
||||
SELECT
|
||||
resourcepolicy_seq.nextval AS policy_id,
|
||||
2 AS resource_type_id,
|
||||
cwf_workflowitem.item_id AS dspace_object,
|
||||
temptable.action_id AS action_id,
|
||||
cwf_pooltask.group_id AS epersongroup_id
|
||||
FROM (cwf_workflowitem INNER JOIN cwf_pooltask ON cwf_workflowitem.workflowitem_id = cwf_pooltask.workflowitem_id),
|
||||
temptable;
|
||||
|
||||
-- Bundles
|
||||
INSERT INTO resourcepolicy (policy_id, resource_type_id, dspace_object, action_id, epersongroup_id)
|
||||
SELECT
|
||||
resourcepolicy_seq.nextval AS policy_id,
|
||||
1 AS resource_type_id,
|
||||
item2bundle.bundle_id AS dspace_object,
|
||||
temptable.action_id AS action_id,
|
||||
cwf_pooltask.group_id AS epersongroup_id
|
||||
FROM
|
||||
(
|
||||
(cwf_workflowitem INNER JOIN cwf_pooltask ON cwf_workflowitem.workflowitem_id = cwf_pooltask.workflowitem_id)
|
||||
INNER JOIN item2bundle ON cwf_workflowitem.item_id = item2bundle.item_id
|
||||
), temptable;
|
||||
|
||||
-- Bitstreams
|
||||
INSERT INTO resourcepolicy (policy_id, resource_type_id, dspace_object, action_id, epersongroup_id)
|
||||
SELECT
|
||||
resourcepolicy_seq.nextval AS policy_id,
|
||||
0 AS resource_type_id,
|
||||
bundle2bitstream.bitstream_id AS dspace_object,
|
||||
temptable.action_id AS action_id,
|
||||
cwf_pooltask.group_id AS epersongroup_id
|
||||
FROM
|
||||
(
|
||||
((cwf_workflowitem INNER JOIN cwf_pooltask ON cwf_workflowitem.workflowitem_id = cwf_pooltask.workflowitem_id)
|
||||
INNER JOIN item2bundle ON cwf_workflowitem.item_id = item2bundle.item_id)
|
||||
INNER JOIN bundle2bitstream ON item2bundle.bundle_id = bundle2bitstream.bundle_id
|
||||
), temptable;
|
||||
|
||||
-- Drop the temporary table with the action ID's
|
||||
DROP TABLE temptable;
|
||||
|
||||
-- Create policies for submitter
|
||||
-- TODO: only add if unique
|
||||
INSERT INTO resourcepolicy (policy_id, resource_type_id, dspace_object, action_id, eperson_id)
|
||||
SELECT
|
||||
resourcepolicy_seq.nextval AS policy_id,
|
||||
2 AS resource_type_id,
|
||||
cwf_workflowitem.item_id AS dspace_object,
|
||||
0 AS action_id,
|
||||
item.submitter_id AS eperson_id
|
||||
FROM (cwf_workflowitem INNER JOIN item ON cwf_workflowitem.item_id = item.uuid);
|
||||
|
||||
INSERT INTO resourcepolicy (policy_id, resource_type_id, dspace_object, action_id, eperson_id)
|
||||
SELECT
|
||||
resourcepolicy_seq.nextval AS policy_id,
|
||||
1 AS resource_type_id,
|
||||
item2bundle.bundle_id AS dspace_object,
|
||||
0 AS action_id,
|
||||
item.submitter_id AS eperson_id
|
||||
FROM ((cwf_workflowitem INNER JOIN item ON cwf_workflowitem.item_id = item.uuid)
|
||||
INNER JOIN item2bundle ON cwf_workflowitem.item_id = item2bundle.item_id
|
||||
);
|
||||
|
||||
INSERT INTO resourcepolicy (policy_id, resource_type_id, dspace_object, action_id, eperson_id)
|
||||
SELECT
|
||||
resourcepolicy_seq.nextval AS policy_id,
|
||||
0 AS resource_type_id,
|
||||
bundle2bitstream.bitstream_id AS dspace_object,
|
||||
0 AS action_id,
|
||||
item.submitter_id AS eperson_id
|
||||
FROM (((cwf_workflowitem INNER JOIN item ON cwf_workflowitem.item_id = item.uuid)
|
||||
INNER JOIN item2bundle ON cwf_workflowitem.item_id = item2bundle.item_id)
|
||||
INNER JOIN bundle2bitstream ON item2bundle.bundle_id = bundle2bitstream.bundle_id
|
||||
);
|
||||
|
||||
-- TODO: not tested yet
|
||||
INSERT INTO cwf_in_progress_user (in_progress_user_id, workflowitem_id, user_id, finished)
|
||||
SELECT
|
||||
cwf_in_progress_user_seq.nextval AS in_progress_user_id,
|
||||
cwf_workflowitem.workflowitem_id AS workflowitem_id,
|
||||
cwf_claimtask.owner_id AS user_id,
|
||||
0 as finished
|
||||
FROM
|
||||
(cwf_claimtask INNER JOIN cwf_workflowitem ON cwf_workflowitem.workflowitem_id = cwf_claimtask.workflowitem_id);
|
||||
|
||||
-- TODO: improve this, important is NVL(curr, 1)!! without this function, empty tables (max = [null]) will only result in sequence deletion
|
||||
DECLARE
|
||||
curr NUMBER := 0;
|
||||
BEGIN
|
||||
SELECT max(workflowitem_id) INTO curr FROM cwf_workflowitem;
|
||||
|
||||
curr := curr + 1;
|
||||
|
||||
EXECUTE IMMEDIATE 'DROP SEQUENCE cwf_workflowitem_seq';
|
||||
|
||||
EXECUTE IMMEDIATE 'CREATE SEQUENCE cwf_workflowitem_seq START WITH ' || NVL(curr, 1);
|
||||
END;
|
||||
/
|
||||
|
||||
DECLARE
|
||||
curr NUMBER := 0;
|
||||
BEGIN
|
||||
SELECT max(collectionrole_id) INTO curr FROM cwf_collectionrole;
|
||||
|
||||
curr := curr + 1;
|
||||
|
||||
EXECUTE IMMEDIATE 'DROP SEQUENCE cwf_collectionrole_seq';
|
||||
|
||||
EXECUTE IMMEDIATE 'CREATE SEQUENCE cwf_collectionrole_seq START WITH ' || NVL(curr, 1);
|
||||
END;
|
||||
/
|
||||
|
||||
DECLARE
|
||||
curr NUMBER := 0;
|
||||
BEGIN
|
||||
SELECT max(workflowitemrole_id) INTO curr FROM cwf_workflowitemrole;
|
||||
|
||||
curr := curr + 1;
|
||||
|
||||
EXECUTE IMMEDIATE 'DROP SEQUENCE cwf_workflowitemrole_seq';
|
||||
|
||||
EXECUTE IMMEDIATE 'CREATE SEQUENCE cwf_workflowitemrole_seq START WITH ' || NVL(curr, 1);
|
||||
END;
|
||||
/
|
||||
|
||||
DECLARE
|
||||
curr NUMBER := 0;
|
||||
BEGIN
|
||||
SELECT max(pooltask_id) INTO curr FROM cwf_pooltask;
|
||||
|
||||
curr := curr + 1;
|
||||
|
||||
EXECUTE IMMEDIATE 'DROP SEQUENCE cwf_pooltask_seq';
|
||||
|
||||
EXECUTE IMMEDIATE 'CREATE SEQUENCE cwf_pooltask_seq START WITH ' || NVL(curr, 1);
|
||||
END;
|
||||
/
|
||||
|
||||
DECLARE
|
||||
curr NUMBER := 0;
|
||||
BEGIN
|
||||
SELECT max(claimtask_id) INTO curr FROM cwf_claimtask;
|
||||
|
||||
curr := curr + 1;
|
||||
|
||||
EXECUTE IMMEDIATE 'DROP SEQUENCE cwf_claimtask_seq';
|
||||
|
||||
EXECUTE IMMEDIATE 'CREATE SEQUENCE cwf_claimtask_seq START WITH ' || NVL(curr, 1);
|
||||
END;
|
||||
/
|
||||
|
||||
DECLARE
|
||||
curr NUMBER := 0;
|
||||
BEGIN
|
||||
SELECT max(in_progress_user_id) INTO curr FROM cwf_in_progress_user;
|
||||
|
||||
curr := curr + 1;
|
||||
|
||||
EXECUTE IMMEDIATE 'DROP SEQUENCE cwf_in_progress_user_seq';
|
||||
|
||||
EXECUTE IMMEDIATE 'CREATE SEQUENCE cwf_in_progress_user_seq START WITH ' || NVL(curr, 1);
|
||||
END;
|
||||
/
|
@@ -1,124 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
----------------------------------------------------
|
||||
-- Database Schema Update for XML/Configurable Workflow (for DSpace 6.0)
|
||||
--
|
||||
-- This file will automatically create/update your
|
||||
-- DSpace Database tables to support XML/Configurable workflows.
|
||||
-- However, it does NOT migrate your existing classic
|
||||
-- workflows. That step is performed by the corresponding
|
||||
-- "data_workflow_migration.sql" script.
|
||||
--
|
||||
-- This script is called automatically by the following
|
||||
-- Flyway Java migration class:
|
||||
-- org.dspace.storage.rdbms.xmlworkflow.V6_0_2015_09_01__DS_2701_Enable_XMLWorkflow_Migration
|
||||
----------------------------------------------------
|
||||
|
||||
CREATE SEQUENCE cwf_workflowitem_seq;
|
||||
CREATE SEQUENCE cwf_collectionrole_seq;
|
||||
CREATE SEQUENCE cwf_workflowitemrole_seq;
|
||||
CREATE SEQUENCE cwf_claimtask_seq;
|
||||
CREATE SEQUENCE cwf_in_progress_user_seq;
|
||||
CREATE SEQUENCE cwf_pooltask_seq;
|
||||
|
||||
|
||||
CREATE TABLE cwf_workflowitem
|
||||
(
|
||||
workflowitem_id INTEGER PRIMARY KEY,
|
||||
item_id RAW(16) REFERENCES item(uuid) UNIQUE,
|
||||
collection_id RAW(16) REFERENCES collection(uuid),
|
||||
--
|
||||
-- Answers to questions on first page of submit UI
|
||||
multiple_titles NUMBER(1),
|
||||
published_before NUMBER(1),
|
||||
multiple_files NUMBER(1)
|
||||
-- Note: stage reached not applicable here - people involved in workflow
|
||||
-- can always jump around submission UI
|
||||
);
|
||||
|
||||
|
||||
CREATE INDEX cwf_workflowitem_coll_fk_idx ON cwf_workflowitem(collection_id);
|
||||
|
||||
|
||||
CREATE TABLE cwf_collectionrole (
|
||||
collectionrole_id INTEGER PRIMARY KEY,
|
||||
role_id VARCHAR2(256),
|
||||
collection_id RAW(16) REFERENCES collection(uuid),
|
||||
group_id RAW(16) REFERENCES epersongroup(uuid)
|
||||
);
|
||||
ALTER TABLE cwf_collectionrole
|
||||
ADD CONSTRAINT cwf_collectionrole_unique UNIQUE (role_id, collection_id, group_id);
|
||||
|
||||
CREATE INDEX cwf_cr_coll_role_fk_idx ON cwf_collectionrole(collection_id,role_id);
|
||||
CREATE INDEX cwf_cr_coll_fk_idx ON cwf_collectionrole(collection_id);
|
||||
|
||||
|
||||
CREATE TABLE cwf_workflowitemrole (
|
||||
workflowitemrole_id INTEGER PRIMARY KEY,
|
||||
role_id VARCHAR2(256),
|
||||
workflowitem_id integer REFERENCES cwf_workflowitem(workflowitem_id),
|
||||
eperson_id RAW(16) REFERENCES eperson(uuid),
|
||||
group_id RAW(16) REFERENCES epersongroup(uuid)
|
||||
);
|
||||
ALTER TABLE cwf_workflowitemrole
|
||||
ADD CONSTRAINT cwf_workflowitemrole_unique UNIQUE (role_id, workflowitem_id, eperson_id, group_id);
|
||||
|
||||
CREATE INDEX cwf_wfir_item_role_fk_idx ON cwf_workflowitemrole(workflowitem_id,role_id);
|
||||
CREATE INDEX cwf_wfir_item_fk_idx ON cwf_workflowitemrole(workflowitem_id);
|
||||
|
||||
|
||||
CREATE TABLE cwf_pooltask (
|
||||
pooltask_id INTEGER PRIMARY KEY,
|
||||
workflowitem_id INTEGER REFERENCES cwf_workflowitem(workflowitem_id),
|
||||
workflow_id VARCHAR2(256),
|
||||
step_id VARCHAR2(256),
|
||||
action_id VARCHAR2(256),
|
||||
eperson_id RAW(16) REFERENCES EPerson(uuid),
|
||||
group_id RAW(16) REFERENCES epersongroup(uuid)
|
||||
);
|
||||
|
||||
CREATE INDEX cwf_pt_eperson_fk_idx ON cwf_pooltask(eperson_id);
|
||||
CREATE INDEX cwf_pt_workflow_fk_idx ON cwf_pooltask(workflowitem_id);
|
||||
CREATE INDEX cwf_pt_workflow_eperson_fk_idx ON cwf_pooltask(eperson_id,workflowitem_id);
|
||||
|
||||
|
||||
|
||||
CREATE TABLE cwf_claimtask (
|
||||
claimtask_id INTEGER PRIMARY KEY,
|
||||
workflowitem_id integer REFERENCES cwf_workflowitem(workflowitem_id),
|
||||
workflow_id VARCHAR2(256),
|
||||
step_id VARCHAR2(256),
|
||||
action_id VARCHAR2(256),
|
||||
owner_id RAW(16) REFERENCES eperson(uuid)
|
||||
);
|
||||
|
||||
ALTER TABLE cwf_claimtask
|
||||
ADD CONSTRAINT cwf_claimtask_unique UNIQUE (step_id, workflowitem_id, workflow_id, owner_id, action_id);
|
||||
|
||||
CREATE INDEX cwf_ct_workflow_fk_idx ON cwf_claimtask(workflowitem_id);
|
||||
CREATE INDEX cwf_ct_workflow_eperson_fk_idx ON cwf_claimtask(workflowitem_id,owner_id);
|
||||
CREATE INDEX cwf_ct_eperson_fk_idx ON cwf_claimtask(owner_id);
|
||||
CREATE INDEX cwf_ct_wfs_fk_idx ON cwf_claimtask(workflowitem_id,step_id);
|
||||
CREATE INDEX cwf_ct_wfs_action_fk_idx ON cwf_claimtask(workflowitem_id,step_id,action_id);
|
||||
CREATE INDEX cwf_ct_wfs_action_e_fk_idx ON cwf_claimtask(workflowitem_id,step_id,action_id,owner_id);
|
||||
|
||||
|
||||
CREATE TABLE cwf_in_progress_user (
|
||||
in_progress_user_id INTEGER PRIMARY KEY,
|
||||
workflowitem_id integer REFERENCES cwf_workflowitem(workflowitem_id),
|
||||
user_id RAW(16) REFERENCES eperson(uuid),
|
||||
finished NUMBER(1) DEFAULT 0
|
||||
);
|
||||
|
||||
ALTER TABLE cwf_in_progress_user
|
||||
ADD CONSTRAINT cwf_in_progress_user_unique UNIQUE (workflowitem_id, user_id);
|
||||
|
||||
CREATE INDEX cwf_ipu_workflow_fk_idx ON cwf_in_progress_user(workflowitem_id);
|
||||
CREATE INDEX cwf_ipu_eperson_fk_idx ON cwf_in_progress_user(user_id);
|
||||
|
@@ -1,124 +0,0 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
----------------------------------------------------
|
||||
-- Database Schema Update for XML/Configurable Workflow
|
||||
--
|
||||
-- This file will automatically create/update your
|
||||
-- DSpace Database tables to support XML/Configurable workflows.
|
||||
-- However, it does NOT migrate your existing classic
|
||||
-- workflows. That step is performed by the corresponding
|
||||
-- "data_workflow_migration.sql" script.
|
||||
--
|
||||
-- This script is called automatically by the following
|
||||
-- Flyway Java migration class:
|
||||
-- org.dspace.storage.rdbms.migration.V5_0_2014_01_01__XMLWorkflow_Migration
|
||||
----------------------------------------------------
|
||||
|
||||
CREATE SEQUENCE cwf_workflowitem_seq;
|
||||
CREATE SEQUENCE cwf_collectionrole_seq;
|
||||
CREATE SEQUENCE cwf_workflowitemrole_seq;
|
||||
CREATE SEQUENCE cwf_claimtask_seq;
|
||||
CREATE SEQUENCE cwf_in_progress_user_seq;
|
||||
CREATE SEQUENCE cwf_pooltask_seq;
|
||||
|
||||
|
||||
CREATE TABLE cwf_workflowitem
|
||||
(
|
||||
workflowitem_id INTEGER PRIMARY KEY,
|
||||
item_id INTEGER REFERENCES item(item_id) UNIQUE,
|
||||
collection_id INTEGER REFERENCES collection(collection_id),
|
||||
--
|
||||
-- Answers to questions on first page of submit UI
|
||||
multiple_titles NUMBER(1),
|
||||
published_before NUMBER(1),
|
||||
multiple_files NUMBER(1)
|
||||
-- Note: stage reached not applicable here - people involved in workflow
|
||||
-- can always jump around submission UI
|
||||
);
|
||||
|
||||
|
||||
CREATE INDEX cwf_workflowitem_coll_fk_idx ON cwf_workflowitem(collection_id);
|
||||
|
||||
|
||||
CREATE TABLE cwf_collectionrole (
|
||||
collectionrole_id INTEGER PRIMARY KEY,
|
||||
role_id VARCHAR2(256),
|
||||
collection_id integer REFERENCES collection(collection_id),
|
||||
group_id integer REFERENCES epersongroup(eperson_group_id)
|
||||
);
|
||||
ALTER TABLE cwf_collectionrole
|
||||
ADD CONSTRAINT cwf_collectionrole_unique UNIQUE (role_id, collection_id, group_id);
|
||||
|
||||
CREATE INDEX cwf_cr_coll_role_fk_idx ON cwf_collectionrole(collection_id,role_id);
|
||||
CREATE INDEX cwf_cr_coll_fk_idx ON cwf_collectionrole(collection_id);
|
||||
|
||||
|
||||
CREATE TABLE cwf_workflowitemrole (
|
||||
workflowitemrole_id INTEGER PRIMARY KEY,
|
||||
role_id VARCHAR2(256),
|
||||
workflowitem_id integer REFERENCES cwf_workflowitem(workflowitem_id),
|
||||
eperson_id integer REFERENCES eperson(eperson_id),
|
||||
group_id integer REFERENCES epersongroup(eperson_group_id)
|
||||
);
|
||||
ALTER TABLE cwf_workflowitemrole
|
||||
ADD CONSTRAINT cwf_workflowitemrole_unique UNIQUE (role_id, workflowitem_id, eperson_id, group_id);
|
||||
|
||||
CREATE INDEX cwf_wfir_item_role_fk_idx ON cwf_workflowitemrole(workflowitem_id,role_id);
|
||||
CREATE INDEX cwf_wfir_item_fk_idx ON cwf_workflowitemrole(workflowitem_id);
|
||||
|
||||
|
||||
CREATE TABLE cwf_pooltask (
|
||||
pooltask_id INTEGER PRIMARY KEY,
|
||||
workflowitem_id INTEGER REFERENCES cwf_workflowitem(workflowitem_id),
|
||||
workflow_id VARCHAR2(256),
|
||||
step_id VARCHAR2(256),
|
||||
action_id VARCHAR2(256),
|
||||
eperson_id INTEGER REFERENCES EPerson(eperson_id),
|
||||
group_id INTEGER REFERENCES epersongroup(eperson_group_id)
|
||||
);
|
||||
|
||||
CREATE INDEX cwf_pt_eperson_fk_idx ON cwf_pooltask(eperson_id);
|
||||
CREATE INDEX cwf_pt_workflow_fk_idx ON cwf_pooltask(workflowitem_id);
|
||||
CREATE INDEX cwf_pt_workflow_eperson_fk_idx ON cwf_pooltask(eperson_id,workflowitem_id);
|
||||
|
||||
|
||||
|
||||
CREATE TABLE cwf_claimtask (
|
||||
claimtask_id INTEGER PRIMARY KEY,
|
||||
workflowitem_id integer REFERENCES cwf_workflowitem(workflowitem_id),
|
||||
workflow_id VARCHAR2(256),
|
||||
step_id VARCHAR2(256),
|
||||
action_id VARCHAR2(256),
|
||||
owner_id integer REFERENCES eperson(eperson_id)
|
||||
);
|
||||
|
||||
ALTER TABLE cwf_claimtask
|
||||
ADD CONSTRAINT cwf_claimtask_unique UNIQUE (step_id, workflowitem_id, workflow_id, owner_id, action_id);
|
||||
|
||||
CREATE INDEX cwf_ct_workflow_fk_idx ON cwf_claimtask(workflowitem_id);
|
||||
CREATE INDEX cwf_ct_workflow_eperson_fk_idx ON cwf_claimtask(workflowitem_id,owner_id);
|
||||
CREATE INDEX cwf_ct_eperson_fk_idx ON cwf_claimtask(owner_id);
|
||||
CREATE INDEX cwf_ct_wfs_fk_idx ON cwf_claimtask(workflowitem_id,step_id);
|
||||
CREATE INDEX cwf_ct_wfs_action_fk_idx ON cwf_claimtask(workflowitem_id,step_id,action_id);
|
||||
CREATE INDEX cwf_ct_wfs_action_e_fk_idx ON cwf_claimtask(workflowitem_id,step_id,action_id,owner_id);
|
||||
|
||||
|
||||
CREATE TABLE cwf_in_progress_user (
|
||||
in_progress_user_id INTEGER PRIMARY KEY,
|
||||
workflowitem_id integer REFERENCES cwf_workflowitem(workflowitem_id),
|
||||
user_id integer REFERENCES eperson(eperson_id),
|
||||
finished NUMBER(1) DEFAULT 0
|
||||
);
|
||||
|
||||
ALTER TABLE cwf_in_progress_user
|
||||
ADD CONSTRAINT cwf_in_progress_user_unique UNIQUE (workflowitem_id, user_id);
|
||||
|
||||
CREATE INDEX cwf_ipu_workflow_fk_idx ON cwf_in_progress_user(workflowitem_id);
|
||||
CREATE INDEX cwf_ipu_eperson_fk_idx ON cwf_in_progress_user(user_id);
|
||||
|
@@ -35,24 +35,6 @@
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>oracle-support</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>db.name</name>
|
||||
<value>oracle</value>
|
||||
</property>
|
||||
</activation>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.oracle</groupId>
|
||||
<artifactId>ojdbc6</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>commons-cli</groupId>
|
||||
|
@@ -24,25 +24,6 @@
|
||||
<root.basedir>${basedir}/..</root.basedir>
|
||||
</properties>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>oracle-support</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>db.name</name>
|
||||
<value>oracle</value>
|
||||
</property>
|
||||
</activation>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.oracle</groupId>
|
||||
<artifactId>ojdbc6</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- Leave this out for the moment, as the source is in the tree -->
|
||||
|
@@ -22,38 +22,6 @@
|
||||
<root.basedir>${basedir}/..</root.basedir>
|
||||
</properties>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>oracle-support</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>db.name</name>
|
||||
<value>oracle</value>
|
||||
</property>
|
||||
</activation>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.oracle</groupId>
|
||||
<artifactId>ojdbc6</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>postgres-support</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>!db.name</name>
|
||||
</property>
|
||||
</activation>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
|
@@ -74,23 +74,15 @@ solr.multicorePrefix =
|
||||
# solr.client.timeToLive = 600
|
||||
|
||||
##### Database settings #####
|
||||
# DSpace only supports two database types: PostgreSQL or Oracle
|
||||
# PostgreSQL is highly recommended.
|
||||
# Oracle support is DEPRECATED. See https://github.com/DSpace/DSpace/issues/8214
|
||||
# DSpace ONLY supports PostgreSQL at this time.
|
||||
|
||||
# URL for connecting to database
|
||||
# * Postgres template: jdbc:postgresql://localhost:5432/dspace
|
||||
# * Oracle template (DEPRECATED): jdbc:oracle:thin:@//localhost:1521/xe
|
||||
db.url = jdbc:postgresql://localhost:5432/dspace
|
||||
|
||||
# JDBC Driver
|
||||
# * For Postgres: org.postgresql.Driver
|
||||
# * For Oracle (DEPRECATED): oracle.jdbc.OracleDriver
|
||||
# JDBC Driver for PostgreSQL
|
||||
db.driver = org.postgresql.Driver
|
||||
|
||||
# Database Dialect (for Hibernate)
|
||||
# * For Postgres: org.hibernate.dialect.PostgreSQL94Dialect
|
||||
# * For Oracle (DEPRECATED): org.hibernate.dialect.Oracle10gDialect
|
||||
# PostgreSQL Database Dialect (for Hibernate)
|
||||
db.dialect = org.hibernate.dialect.PostgreSQL94Dialect
|
||||
|
||||
# Database username and password
|
||||
@@ -98,9 +90,7 @@ db.username = dspace
|
||||
db.password = dspace
|
||||
|
||||
# Database Schema name
|
||||
# * For Postgres, this is often "public" (default schema)
|
||||
# * For Oracle (DEPRECATED), schema is equivalent to the username of your database account,
|
||||
# so this may be set to ${db.username} in most scenarios.
|
||||
# For PostgreSQL, this is often "public" (default schema)
|
||||
db.schema = public
|
||||
|
||||
## Database Connection pool parameters
|
||||
|
@@ -71,23 +71,15 @@ dspace.name = DSpace at My University
|
||||
##########################
|
||||
# DATABASE CONFIGURATION #
|
||||
##########################
|
||||
# DSpace only supports two database types: PostgreSQL or Oracle
|
||||
# PostgreSQL is highly recommended.
|
||||
# Oracle support is DEPRECATED. See https://github.com/DSpace/DSpace/issues/8214
|
||||
# DSpace ONLY supports PostgreSQL at this time.
|
||||
|
||||
# URL for connecting to database
|
||||
# * Postgres template: jdbc:postgresql://localhost:5432/dspace
|
||||
# * Oracle template (DEPRECATED): jdbc:oracle:thin:@//localhost:1521/xe
|
||||
db.url = jdbc:postgresql://localhost:5432/dspace
|
||||
|
||||
# JDBC Driver
|
||||
# * For Postgres: org.postgresql.Driver
|
||||
# * For Oracle (DEPRECATED): oracle.jdbc.OracleDriver
|
||||
# JDBC Driver for PostgreSQL
|
||||
db.driver = org.postgresql.Driver
|
||||
|
||||
# Database Dialect (for Hibernate)
|
||||
# * For Postgres: org.hibernate.dialect.PostgreSQL94Dialect
|
||||
# * For Oracle (DEPRECATED): org.hibernate.dialect.Oracle10gDialect
|
||||
# PostgreSQL Database Dialect (for Hibernate)
|
||||
db.dialect = org.hibernate.dialect.PostgreSQL94Dialect
|
||||
|
||||
# Database username and password
|
||||
@@ -95,9 +87,7 @@ db.username = dspace
|
||||
db.password = dspace
|
||||
|
||||
# Database Schema name
|
||||
# * For Postgres, this is often "public" (default schema)
|
||||
# * For Oracle (DEPRECATED), schema is equivalent to the username of your database account,
|
||||
# so this may be set to ${db.username} in most scenarios.
|
||||
# For PostgreSQL, this is often "public" (default schema)
|
||||
db.schema = public
|
||||
|
||||
## Connection pool parameters
|
||||
|
@@ -61,22 +61,6 @@
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>oracle-support</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>db.name</name>
|
||||
<value>oracle</value>
|
||||
</property>
|
||||
</activation>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.oracle</groupId>
|
||||
<artifactId>ojdbc6</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<!-- Setup the Unit Test Environment (when -DskipUnitTests=false) -->
|
||||
<profile>
|
||||
<id>unit-test-environment</id>
|
||||
|
@@ -90,24 +90,6 @@
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>oracle-support</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>db.name</name>
|
||||
<value>oracle</value>
|
||||
</property>
|
||||
</activation>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.oracle</groupId>
|
||||
<artifactId>ojdbc6</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
|
@@ -244,22 +244,6 @@ just adding new jar in the classloader</description>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>oracle-support</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>db.name</name>
|
||||
<value>oracle</value>
|
||||
</property>
|
||||
</activation>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.oracle</groupId>
|
||||
<artifactId>ojdbc6</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<dependencies>
|
||||
|
5
pom.xml
5
pom.xml
@@ -1617,11 +1617,6 @@
|
||||
<artifactId>icu4j</artifactId>
|
||||
<version>62.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.oracle</groupId>
|
||||
<artifactId>ojdbc6</artifactId>
|
||||
<version>11.2.0.4.0</version>
|
||||
</dependency>
|
||||
<!-- Codebase at https://github.com/DSpace/oclc-harvester2 -->
|
||||
<dependency>
|
||||
<groupId>org.dspace</groupId>
|
||||
|
Reference in New Issue
Block a user