mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
Fixes to Oracle Schema scripts based on DS-289: OAI-PMH + OAI-ORE harvesting support.
These seem to create the tables properly in Oracle 10g (based on my limited testing with a local Oracle install), and they also help fix DS-423 for Oracle. git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@4719 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -69,6 +69,8 @@ CREATE SEQUENCE metadatafieldregistry_seq;
|
|||||||
CREATE SEQUENCE metadatavalue_seq;
|
CREATE SEQUENCE metadatavalue_seq;
|
||||||
CREATE SEQUENCE group2group_seq;
|
CREATE SEQUENCE group2group_seq;
|
||||||
CREATE SEQUENCE group2groupcache_seq;
|
CREATE SEQUENCE group2groupcache_seq;
|
||||||
|
CREATE SEQUENCE harvested_collection_seq;
|
||||||
|
CREATE SEQUENCE harvested_item_seq;
|
||||||
|
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
-- BitstreamFormatRegistry table
|
-- BitstreamFormatRegistry table
|
||||||
@@ -534,9 +536,6 @@ CREATE TABLE EPersonGroup2WorkspaceItem
|
|||||||
CREATE INDEX epg2wi_group_fk_idx ON epersongroup2workspaceitem(eperson_group_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 epg2wi_workspace_fk_idx ON epersongroup2workspaceitem(workspace_item_id);
|
||||||
|
|
||||||
------------------------------------------------------------
|
|
||||||
-- Browse subsystem tables and views
|
|
||||||
------------------------------------------------------------
|
|
||||||
|
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
-- Communities2Item table
|
-- Communities2Item table
|
||||||
@@ -701,3 +700,36 @@ values
|
|||||||
'BITSTREAM_MARKED_DELETED',
|
'BITSTREAM_MARKED_DELETED',
|
||||||
'Bitstream marked deleted in bitstream table'
|
'Bitstream marked deleted in bitstream table'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
-------------------------------------------------------
|
||||||
|
-- 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,112 +1,153 @@
|
|||||||
--
|
--
|
||||||
-- database_schema_15-16.sql
|
-- database_schema_15-16.sql
|
||||||
--
|
--
|
||||||
-- Version: $$
|
-- Version: $$
|
||||||
--
|
--
|
||||||
-- Date: $Date: 2009-04-23 22:26:59 -0500 (Thu, 23 Apr 2009) $
|
-- Date: $Date: 2009-04-23 22:26:59 -0500 (Thu, 23 Apr 2009) $
|
||||||
--
|
--
|
||||||
-- Copyright (c) 2002-2009, The DSpace Foundation. All rights reserved.
|
-- Copyright (c) 2002-2009, The DSpace Foundation. All rights reserved.
|
||||||
--
|
--
|
||||||
-- Redistribution and use in source and binary forms, with or without
|
-- Redistribution and use in source and binary forms, with or without
|
||||||
-- modification, are permitted provided that the following conditions are
|
-- modification, are permitted provided that the following conditions are
|
||||||
-- met:
|
-- met:
|
||||||
--
|
--
|
||||||
-- - Redistributions of source code must retain the above copyright
|
-- - Redistributions of source code must retain the above copyright
|
||||||
-- notice, this list of conditions and the following disclaimer.
|
-- notice, this list of conditions and the following disclaimer.
|
||||||
--
|
--
|
||||||
-- - Redistributions in binary form must reproduce the above copyright
|
-- - Redistributions in binary form must reproduce the above copyright
|
||||||
-- notice, this list of conditions and the following disclaimer in the
|
-- notice, this list of conditions and the following disclaimer in the
|
||||||
-- documentation and/or other materials provided with the distribution.
|
-- documentation and/or other materials provided with the distribution.
|
||||||
--
|
--
|
||||||
-- - Neither the name of the DSpace Foundation nor the names of its
|
-- - Neither the name of the DSpace Foundation nor the names of its
|
||||||
-- contributors may be used to endorse or promote products derived from
|
-- contributors may be used to endorse or promote products derived from
|
||||||
-- this software without specific prior written permission.
|
-- this software without specific prior written permission.
|
||||||
--
|
--
|
||||||
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
-- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
-- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
-- HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
-- HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
-- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
-- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
-- BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
-- BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
-- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
-- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
-- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
-- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||||
-- TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
-- TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||||
-- USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
-- USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
-- DAMAGE.
|
-- DAMAGE.
|
||||||
|
|
||||||
--
|
--
|
||||||
-- SQL commands to upgrade the database schema of a live DSpace 1.5 or 1.5.x
|
-- SQL commands to upgrade the database schema of a live DSpace 1.5 or 1.5.x
|
||||||
-- to the DSpace 1.6 database schema
|
-- to the DSpace 1.6 database schema
|
||||||
--
|
--
|
||||||
-- DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST.
|
-- DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST.
|
||||||
-- DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST.
|
-- DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST.
|
||||||
-- DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST.
|
-- DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST.
|
||||||
|
|
||||||
------------------------------------------------------------------
|
------------------------------------------------------------------
|
||||||
-- New Column for Community Admin - Delegated Admin patch (DS-228)
|
-- New Column for Community Admin - Delegated Admin patch (DS-228)
|
||||||
------------------------------------------------------------------
|
------------------------------------------------------------------
|
||||||
ALTER TABLE community ADD admin INTEGER REFERENCES epersongroup ( eperson_group_id );
|
ALTER TABLE community ADD admin INTEGER REFERENCES epersongroup ( eperson_group_id );
|
||||||
CREATE INDEX community_admin_fk_idx ON Community(admin);
|
CREATE INDEX community_admin_fk_idx ON Community(admin);
|
||||||
|
|
||||||
-------------------------------------------------------------------------
|
-------------------------------------------------------------------------
|
||||||
-- DS-236 schema changes for Authority Control of Metadata Values
|
-- DS-236 schema changes for Authority Control of Metadata Values
|
||||||
-------------------------------------------------------------------------
|
-------------------------------------------------------------------------
|
||||||
ALTER TABLE MetadataValue
|
ALTER TABLE MetadataValue
|
||||||
ADD ( authority VARCHAR(100),
|
ADD ( authority VARCHAR(100),
|
||||||
confidence INTEGER DEFAULT -1);
|
confidence INTEGER DEFAULT -1);
|
||||||
|
|
||||||
--------------------------------------------------------------------------
|
--------------------------------------------------------------------------
|
||||||
-- DS-295 CC License being assigned incorrect Mime Type during submission.
|
-- DS-295 CC License being assigned incorrect Mime Type during submission.
|
||||||
--------------------------------------------------------------------------
|
--------------------------------------------------------------------------
|
||||||
UPDATE bitstream SET bitstream_format_id =
|
UPDATE bitstream SET bitstream_format_id =
|
||||||
(SELECT bitstream_format_id FROM bitstreamformatregistry WHERE short_description = 'CC License')
|
(SELECT bitstream_format_id FROM bitstreamformatregistry WHERE short_description = 'CC License')
|
||||||
WHERE name = 'license_text' AND source = 'org.dspace.license.CreativeCommons';
|
WHERE name = 'license_text' AND source = 'org.dspace.license.CreativeCommons';
|
||||||
|
|
||||||
UPDATE bitstream SET bitstream_format_id =
|
UPDATE bitstream SET bitstream_format_id =
|
||||||
(SELECT bitstream_format_id FROM bitstreamformatregistry WHERE short_description = 'RDF XML')
|
(SELECT bitstream_format_id FROM bitstreamformatregistry WHERE short_description = 'RDF XML')
|
||||||
WHERE name = 'license_rdf' AND source = 'org.dspace.license.CreativeCommons';
|
WHERE name = 'license_rdf' AND source = 'org.dspace.license.CreativeCommons';
|
||||||
|
|
||||||
-------------------------------------------------------------------------
|
-------------------------------------------------------------------------
|
||||||
-- DS-260 Cleanup of Owning collection column for template item created
|
-- DS-260 Cleanup of Owning collection column for template item created
|
||||||
-- with the JSPUI after the collection creation
|
-- with the JSPUI after the collection creation
|
||||||
-------------------------------------------------------------------------
|
-------------------------------------------------------------------------
|
||||||
UPDATE item SET owning_collection = null WHERE item_id IN
|
UPDATE item SET owning_collection = null WHERE item_id IN
|
||||||
(SELECT template_item_id FROM collection WHERE template_item_id IS NOT null);
|
(SELECT template_item_id FROM collection WHERE template_item_id IS NOT null);
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------
|
||||||
-- You need to remove the already in place constraints to add the deferrable option
|
-- You need to remove the already in place constraints to add the deferrable option
|
||||||
-- because the constraints name was generated by your oracle instance you need to discovery it before
|
-- because the constraints name was generated by your oracle instance you need to discovery it before
|
||||||
-- Just copy and paste the commands printed by these three queries:
|
-- Just copy and paste the commands printed by these three queries:
|
||||||
|
|
||||||
-- 1. community2collection
|
-- 1. community2collection
|
||||||
select 'ALTER TABLE '||c1.table_name||' DROP CONSTRAINT '||
|
select 'ALTER TABLE '||c1.table_name||' DROP CONSTRAINT '||
|
||||||
c1.constraint_name||';' command from user_constraints c1, user_constraints c2
|
c1.constraint_name||';' command from user_constraints c1, user_constraints c2
|
||||||
where c1.constraint_type = 'R' and c1.r_constraint_name = c2.constraint_name
|
where c1.constraint_type = 'R' and c1.r_constraint_name = c2.constraint_name
|
||||||
and c1.table_name like 'COMMUNITY2COLLECTION'
|
and c1.table_name like 'COMMUNITY2COLLECTION'
|
||||||
and c2.table_name LIKE 'COLLECTION';
|
and c2.table_name LIKE 'COLLECTION';
|
||||||
|
|
||||||
-- 2. community2community
|
-- 2. community2community
|
||||||
select 'ALTER TABLE '||c1.table_name||' DROP CONSTRAINT '||
|
select 'ALTER TABLE '||c1.table_name||' DROP CONSTRAINT '||
|
||||||
c1.constraint_name||';' command from user_constraints c1, user_constraints c2
|
c1.constraint_name||';' command from user_constraints c1, user_constraints c2
|
||||||
where c1.constraint_type = 'R' and c1.r_constraint_name = c2.constraint_name
|
where c1.constraint_type = 'R' and c1.r_constraint_name = c2.constraint_name
|
||||||
and c1.table_name like 'COMMUNITY2COMMUNITY'
|
and c1.table_name like 'COMMUNITY2COMMUNITY'
|
||||||
and c2.table_name LIKE 'COMMUNITY';
|
and c2.table_name LIKE 'COMMUNITY';
|
||||||
|
|
||||||
-- 3. collection2item
|
-- 3. collection2item
|
||||||
select 'ALTER TABLE '||c1.table_name||' DROP CONSTRAINT '||
|
select 'ALTER TABLE '||c1.table_name||' DROP CONSTRAINT '||
|
||||||
c1.constraint_name||';' command from user_constraints c1, user_constraints c2
|
c1.constraint_name||';' command from user_constraints c1, user_constraints c2
|
||||||
where c1.constraint_type = 'R' and c1.r_constraint_name = c2.constraint_name
|
where c1.constraint_type = 'R' and c1.r_constraint_name = c2.constraint_name
|
||||||
and c1.table_name like 'COLLECTION2ITEM'
|
and c1.table_name like 'COLLECTION2ITEM'
|
||||||
and c2.table_name LIKE 'ITEM';
|
and c2.table_name LIKE 'ITEM';
|
||||||
|
|
||||||
--
|
--
|
||||||
-- e.g.
|
-- e.g.
|
||||||
-- ALTER TABLE community2collection DROP CONSTRAINT THECONSTRAINTNAMETHATYOUHAVEFINDWITHTHE1stQUERY;
|
-- ALTER TABLE community2collection DROP CONSTRAINT THECONSTRAINTNAMETHATYOUHAVEFINDWITHTHE1stQUERY;
|
||||||
-- ALTER TABLE community2community DROP CONSTRAINT THECONSTRAINTNAMETHATYOUHAVEFINDWITHTHE2ndQUERY;
|
-- ALTER TABLE community2community DROP CONSTRAINT THECONSTRAINTNAMETHATYOUHAVEFINDWITHTHE2ndQUERY;
|
||||||
-- ALTER TABLE collection2item DROP CONSTRAINT THECONSTRAINTNAMETHATYOUHAVEFINDWITHTHE3rdQUERY;
|
-- ALTER TABLE collection2item DROP CONSTRAINT THECONSTRAINTNAMETHATYOUHAVEFINDWITHTHE3rdQUERY;
|
||||||
|
|
||||||
-- now recreate them with a know name and deferrable option!
|
-- now recreate them with a know name and deferrable option!
|
||||||
select 'ALTER TABLE community2collection ADD CONSTRAINT comm2coll_collection_fk FOREIGN KEY (collection_id) REFERENCES collection DEFERRABLE;' from dual;
|
select 'ALTER TABLE community2collection ADD CONSTRAINT comm2coll_collection_fk FOREIGN KEY (collection_id) REFERENCES collection DEFERRABLE;' from dual;
|
||||||
select 'ALTER TABLE community2community ADD CONSTRAINT com2com_child_fk FOREIGN KEY (child_comm_id) REFERENCES community DEFERRABLE;' from dual;
|
select 'ALTER TABLE community2community ADD CONSTRAINT com2com_child_fk FOREIGN KEY (child_comm_id) REFERENCES community DEFERRABLE;' from dual;
|
||||||
select 'ALTER TABLE collection2item ADD CONSTRAINT coll2item_item_fk FOREIGN KEY (item_id) REFERENCES item DEFERRABLE;' from dual;
|
select 'ALTER TABLE collection2item ADD CONSTRAINT coll2item_item_fk FOREIGN KEY (item_id) REFERENCES item DEFERRABLE;' from dual;
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------
|
||||||
|
-- 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);
|
||||||
|
|
||||||
|
@@ -81,11 +81,10 @@
|
|||||||
@updateseq.sql tasklistitem_seq tasklistitem tasklist_id
|
@updateseq.sql tasklistitem_seq tasklistitem tasklist_id
|
||||||
@updateseq.sql registrationdata_seq registrationdata registrationdata_id
|
@updateseq.sql registrationdata_seq registrationdata registrationdata_id
|
||||||
@updateseq.sql subscription_seq subscription subscription_id
|
@updateseq.sql subscription_seq subscription subscription_id
|
||||||
@updateseq.sql history_seq history history_id
|
|
||||||
@updateseq.sql historystate_seq historystate history_state_id
|
|
||||||
@updateseq.sql communities2item_seq communities2item id
|
@updateseq.sql communities2item_seq communities2item id
|
||||||
@updateseq.sql itemsbyauthor_seq itemsbyauthor items_by_author_id
|
@updateseq.sql epersongroup2workspaceitem_seq epersongroup2workspaceitem id
|
||||||
@updateseq.sql itemsbytitle_seq itemsbytitle items_by_title_id
|
@updateseq.sql metadatafieldregistry_seq metadatafieldregistry metadata_field_id
|
||||||
@updateseq.sql itemsbydate_seq itemsbydate items_by_date_id
|
@updateseq.sql metadatavalue_seq metadatavalue metadata_value_id
|
||||||
@updateseq.sql itemsbydateaccessioned_seq itemsbydateaccessioned items_by_date_accessioned_id
|
@updateseq.sql metadataschemaregistry_seq metadataschemaregistry metadata_schema_id
|
||||||
@updateseq.sql epersongroup2workspaceitem_seq epersongroup2workspaceitem id
|
@updateseq.sql harvested_collection_seq harvested_collection id
|
||||||
|
@updateseq.sql harvested_item_seq harvested_item id
|
Reference in New Issue
Block a user