Hi,
I finally got a chance to look at the database SQL backup that you
forwarded along. I've noticed that it does *not* seem to be a complete
backup (which may be why you are having upgrade issues).
Here's what is missing from a "normal" DSpace database schema:
1) Your backup has *no* database indexes ("CREATE INDEX" statements)
2) Your backup has *no* database constraints or primary keys ("ALTER
TABLE..ADD CONSTRAINT" statements
3) Your backup also has no Community/Collection/Item data (those tables
are completely empty) -- but maybe you excluded it on purpose?
In any case, I can reproduce the errors you are seeing using your
database backup. Here's what I've found out, and how to fix your issues
in upgrading to DSpace 5.
-----
ERROR #1: "ERROR: there is no unique constraint matching given keys
for referenced table "item" STATEMENT: CREATE TABLE versionitem..."
CAUSE: This is being caused because you backup has *no* database
constraints or primary keys specified (#2 above). So, this error is
thrown because your Item table has no "primary key" specified, and
DSpace is therefore unable to associate the primary key with the new
"versionitem" table.
HOW TO FIX: I've attached a custom "add-constraints-and-indexes.sql"
file which contains *ALL* the constraints & indexes which are missing
from your DSpace 1.8 database backup. You will need to run this SQL on
your local database to recreate these constraints & indexes, PRIOR to
upgrading the database.
---
ERROR #2 : "Error attempting to update Bitstream Format and/or Metadata
Registries org.postgresql.util.PSQLException: ERROR: null value in
column "bitstream_format_id" violates not-null constraint"
CAUSE: This seems to be caused by an outdated
"bitstreamformatregistry_seq" sequence. But, that's easy to fix.
HOW TO FIX: Simply run the [dspace]/etc/postgres/update-sequences.sql
script on your database. This will update all your database sequences to
the correct values. Again you should run this PRIOR to upgrading the
database.
--
FINALLY, after fixing both of those errors, you should simply re-run:
'dspace database migrate'
This time, the migration *should* succeed. However, as mentioned above
your Community/Collection/Item tables may end up empty, unless you find
a way to recover that data from your backup.
Good luck,
Tim
--
-- Name: bitstream_pkey; Type: CONSTRAINT; Schema: public; Owner: dspace;
Tablespace:
--
ALTER TABLE ONLY bitstream
ADD CONSTRAINT bitstream_pkey PRIMARY KEY (bitstream_id);
--
-- Name: bitstreamformatregistry_pkey; Type: CONSTRAINT; Schema: public; Owner:
dspace; Tablespace:
--
ALTER TABLE ONLY bitstreamformatregistry
ADD CONSTRAINT bitstreamformatregistry_pkey PRIMARY KEY
(bitstream_format_id);
--
-- Name: bitstreamformatregistry_short_description_key; Type: CONSTRAINT;
Schema: public; Owner: dspace; Tablespace:
--
ALTER TABLE ONLY bitstreamformatregistry
ADD CONSTRAINT bitstreamformatregistry_short_description_key UNIQUE
(short_description);
--
-- Name: bundle2bitstream_pkey; Type: CONSTRAINT; Schema: public; Owner:
dspace; Tablespace:
--
ALTER TABLE ONLY bundle2bitstream
ADD CONSTRAINT bundle2bitstream_pkey PRIMARY KEY (id);
--
-- Name: bundle_pkey; Type: CONSTRAINT; Schema: public; Owner: dspace;
Tablespace:
--
ALTER TABLE ONLY bundle
ADD CONSTRAINT bundle_pkey PRIMARY KEY (bundle_id);
--
-- Name: checksum_history_pkey; Type: CONSTRAINT; Schema: public; Owner:
dspace; Tablespace:
--
ALTER TABLE ONLY checksum_history
ADD CONSTRAINT checksum_history_pkey PRIMARY KEY (check_id);
--
-- Name: checksum_results_pkey; Type: CONSTRAINT; Schema: public; Owner:
dspace; Tablespace:
--
ALTER TABLE ONLY checksum_results
ADD CONSTRAINT checksum_results_pkey PRIMARY KEY (result_code);
--
-- Name: collection2item_pkey; Type: CONSTRAINT; Schema: public; Owner: dspace;
Tablespace:
--
ALTER TABLE ONLY collection2item
ADD CONSTRAINT collection2item_pkey PRIMARY KEY (id);
--
-- Name: collection_item_count_pkey; Type: CONSTRAINT; Schema: public; Owner:
dspace; Tablespace:
--
ALTER TABLE ONLY collection_item_count
ADD CONSTRAINT collection_item_count_pkey PRIMARY KEY (collection_id);
--
-- Name: collection_pkey; Type: CONSTRAINT; Schema: public; Owner: dspace;
Tablespace:
--
ALTER TABLE ONLY collection
ADD CONSTRAINT collection_pkey PRIMARY KEY (collection_id);
--
-- Name: communities2item_pkey; Type: CONSTRAINT; Schema: public; Owner:
dspace; Tablespace:
--
ALTER TABLE ONLY communities2item
ADD CONSTRAINT communities2item_pkey PRIMARY KEY (id);
--
-- Name: community2collection_pkey; Type: CONSTRAINT; Schema: public; Owner:
dspace; Tablespace:
--
ALTER TABLE ONLY community2collection
ADD CONSTRAINT community2collection_pkey PRIMARY KEY (id);
--
-- Name: community2community_pkey; Type: CONSTRAINT; Schema: public; Owner:
dspace; Tablespace:
--
ALTER TABLE ONLY community2community
ADD CONSTRAINT community2community_pkey PRIMARY KEY (id);
--
-- Name: community_item_count_pkey; Type: CONSTRAINT; Schema: public; Owner:
dspace; Tablespace:
--
ALTER TABLE ONLY community_item_count
ADD CONSTRAINT community_item_count_pkey PRIMARY KEY (community_id);
--
-- Name: community_pkey; Type: CONSTRAINT; Schema: public; Owner: dspace;
Tablespace:
--
ALTER TABLE ONLY community
ADD CONSTRAINT community_pkey PRIMARY KEY (community_id);
--
-- Name: eperson_email_key; Type: CONSTRAINT; Schema: public; Owner: dspace;
Tablespace:
--
ALTER TABLE ONLY eperson
ADD CONSTRAINT eperson_email_key UNIQUE (email);
--
-- Name: eperson_netid_key; Type: CONSTRAINT; Schema: public; Owner: dspace;
Tablespace:
--
ALTER TABLE ONLY eperson
ADD CONSTRAINT eperson_netid_key UNIQUE (netid);
--
-- Name: eperson_pkey; Type: CONSTRAINT; Schema: public; Owner: dspace;
Tablespace:
--
ALTER TABLE ONLY eperson
ADD CONSTRAINT eperson_pkey PRIMARY KEY (eperson_id);
--
-- Name: epersongroup2eperson_pkey; Type: CONSTRAINT; Schema: public; Owner:
dspace; Tablespace:
--
ALTER TABLE ONLY epersongroup2eperson
ADD CONSTRAINT epersongroup2eperson_pkey PRIMARY KEY (id);
--
-- Name: epersongroup2item_pkey; Type: CONSTRAINT; Schema: public; Owner:
dspace; Tablespace:
--
ALTER TABLE ONLY epersongroup2workspaceitem
ADD CONSTRAINT epersongroup2item_pkey PRIMARY KEY (id);
--
-- Name: epersongroup_name_key; Type: CONSTRAINT; Schema: public; Owner:
dspace; Tablespace:
--
ALTER TABLE ONLY epersongroup
ADD CONSTRAINT epersongroup_name_key UNIQUE (name);
--
-- Name: epersongroup_pkey; Type: CONSTRAINT; Schema: public; Owner: dspace;
Tablespace:
--
ALTER TABLE ONLY epersongroup
ADD CONSTRAINT epersongroup_pkey PRIMARY KEY (eperson_group_id);
--
-- Name: fileextension_pkey; Type: CONSTRAINT; Schema: public; Owner: dspace;
Tablespace:
--
ALTER TABLE ONLY fileextension
ADD CONSTRAINT fileextension_pkey PRIMARY KEY (file_extension_id);
--
-- Name: group2group_pkey; Type: CONSTRAINT; Schema: public; Owner: dspace;
Tablespace:
--
ALTER TABLE ONLY group2group
ADD CONSTRAINT group2group_pkey PRIMARY KEY (id);
--
-- Name: group2groupcache_pkey; Type: CONSTRAINT; Schema: public; Owner:
dspace; Tablespace:
--
ALTER TABLE ONLY group2groupcache
ADD CONSTRAINT group2groupcache_pkey PRIMARY KEY (id);
--
-- Name: handle_handle_key; Type: CONSTRAINT; Schema: public; Owner: dspace;
Tablespace:
--
ALTER TABLE ONLY handle
ADD CONSTRAINT handle_handle_key UNIQUE (handle);
--
-- Name: handle_pkey; Type: CONSTRAINT; Schema: public; Owner: dspace;
Tablespace:
--
ALTER TABLE ONLY handle
ADD CONSTRAINT handle_pkey PRIMARY KEY (handle_id);
--
-- Name: harvested_collection_pkey; Type: CONSTRAINT; Schema: public; Owner:
dspace; Tablespace:
--
ALTER TABLE ONLY harvested_collection
ADD CONSTRAINT harvested_collection_pkey PRIMARY KEY (id);
--
-- Name: harvested_item_pkey; Type: CONSTRAINT; Schema: public; Owner: dspace;
Tablespace:
--
ALTER TABLE ONLY harvested_item
ADD CONSTRAINT harvested_item_pkey PRIMARY KEY (id);
--
-- Name: item2bundle_pkey; Type: CONSTRAINT; Schema: public; Owner: dspace;
Tablespace:
--
ALTER TABLE ONLY item2bundle
ADD CONSTRAINT item2bundle_pkey PRIMARY KEY (id);
--
-- Name: item_pkey; Type: CONSTRAINT; Schema: public; Owner: dspace;
Tablespace:
--
ALTER TABLE ONLY item
ADD CONSTRAINT item_pkey PRIMARY KEY (item_id);
--
-- Name: metadatafieldregistry_pkey; Type: CONSTRAINT; Schema: public; Owner:
dspace; Tablespace:
--
ALTER TABLE ONLY metadatafieldregistry
ADD CONSTRAINT metadatafieldregistry_pkey PRIMARY KEY (metadata_field_id);
--
-- Name: metadataschemaregistry_namespace_key; Type: CONSTRAINT; Schema:
public; Owner: dspace; Tablespace:
--
ALTER TABLE ONLY metadataschemaregistry
ADD CONSTRAINT metadataschemaregistry_namespace_key UNIQUE (namespace);
--
-- Name: metadataschemaregistry_pkey; Type: CONSTRAINT; Schema: public; Owner:
dspace; Tablespace:
--
ALTER TABLE ONLY metadataschemaregistry
ADD CONSTRAINT metadataschemaregistry_pkey PRIMARY KEY (metadata_schema_id);
--
-- Name: metadatavalue_pkey; Type: CONSTRAINT; Schema: public; Owner: dspace;
Tablespace:
--
ALTER TABLE ONLY metadatavalue
ADD CONSTRAINT metadatavalue_pkey PRIMARY KEY (metadata_value_id);
--
-- Name: most_recent_checksum_pkey; Type: CONSTRAINT; Schema: public; Owner:
dspace; Tablespace:
--
ALTER TABLE ONLY most_recent_checksum
ADD CONSTRAINT most_recent_checksum_pkey PRIMARY KEY (bitstream_id);
--
-- Name: registrationdata_email_key; Type: CONSTRAINT; Schema: public; Owner:
dspace; Tablespace:
--
ALTER TABLE ONLY registrationdata
ADD CONSTRAINT registrationdata_email_key UNIQUE (email);
--
-- Name: registrationdata_pkey; Type: CONSTRAINT; Schema: public; Owner:
dspace; Tablespace:
--
ALTER TABLE ONLY registrationdata
ADD CONSTRAINT registrationdata_pkey PRIMARY KEY (registrationdata_id);
--
-- Name: resourcepolicy_pkey; Type: CONSTRAINT; Schema: public; Owner: dspace;
Tablespace:
--
ALTER TABLE ONLY resourcepolicy
ADD CONSTRAINT resourcepolicy_pkey PRIMARY KEY (policy_id);
--
-- Name: subscription_pkey; Type: CONSTRAINT; Schema: public; Owner: dspace;
Tablespace:
--
ALTER TABLE ONLY subscription
ADD CONSTRAINT subscription_pkey PRIMARY KEY (subscription_id);
--
-- Name: tasklistitem_pkey; Type: CONSTRAINT; Schema: public; Owner: dspace;
Tablespace:
--
ALTER TABLE ONLY tasklistitem
ADD CONSTRAINT tasklistitem_pkey PRIMARY KEY (tasklist_id);
--
-- Name: workflowitem_item_id_key; Type: CONSTRAINT; Schema: public; Owner:
dspace; Tablespace:
--
ALTER TABLE ONLY workflowitem
ADD CONSTRAINT workflowitem_item_id_key UNIQUE (item_id);
--
-- Name: workflowitem_pkey; Type: CONSTRAINT; Schema: public; Owner: dspace;
Tablespace:
--
ALTER TABLE ONLY workflowitem
ADD CONSTRAINT workflowitem_pkey PRIMARY KEY (workflow_id);
--
-- Name: workspaceitem_pkey; Type: CONSTRAINT; Schema: public; Owner: dspace;
Tablespace:
--
ALTER TABLE ONLY workspaceitem
ADD CONSTRAINT workspaceitem_pkey PRIMARY KEY (workspace_item_id);
--
-- Name: bit_bitstream_fk_idx; Type: INDEX; Schema: public; Owner: dspace;
Tablespace:
--
CREATE INDEX bit_bitstream_fk_idx ON bitstream USING btree
(bitstream_format_id);
--
-- Name: bundle2bitstream_bitstream_fk_idx; Type: INDEX; Schema: public; Owner:
dspace; Tablespace:
--
CREATE INDEX bundle2bitstream_bitstream_fk_idx ON bundle2bitstream USING btree
(bitstream_id);
--
-- Name: bundle2bitstream_bundle_idx; Type: INDEX; Schema: public; Owner:
dspace; Tablespace:
--
CREATE INDEX bundle2bitstream_bundle_idx ON bundle2bitstream USING btree
(bundle_id);
--
-- Name: bundle_primary_fk_idx; Type: INDEX; Schema: public; Owner: dspace;
Tablespace:
--
CREATE INDEX bundle_primary_fk_idx ON bundle USING btree (primary_bitstream_id);
--
-- Name: ch_result_fk_idx; Type: INDEX; Schema: public; Owner: dspace;
Tablespace:
--
CREATE INDEX ch_result_fk_idx ON checksum_history USING btree (result);
--
-- Name: collection2item_collection_idx; Type: INDEX; Schema: public; Owner:
dspace; Tablespace:
--
CREATE INDEX collection2item_collection_idx ON collection2item USING btree
(collection_id);
--
-- Name: collection2item_item_id_idx; Type: INDEX; Schema: public; Owner:
dspace; Tablespace:
--
CREATE INDEX collection2item_item_id_idx ON collection2item USING btree
(item_id);
--
-- Name: collection_admin_fk_idx; Type: INDEX; Schema: public; Owner: dspace;
Tablespace:
--
CREATE INDEX collection_admin_fk_idx ON collection USING btree (admin);
--
-- Name: collection_logo_fk_idx; Type: INDEX; Schema: public; Owner: dspace;
Tablespace:
--
CREATE INDEX collection_logo_fk_idx ON collection USING btree
(logo_bitstream_id);
--
-- Name: collection_submitter_fk_idx; Type: INDEX; Schema: public; Owner:
dspace; Tablespace:
--
CREATE INDEX collection_submitter_fk_idx ON collection USING btree (submitter);
--
-- Name: collection_template_fk_idx; Type: INDEX; Schema: public; Owner:
dspace; Tablespace:
--
CREATE INDEX collection_template_fk_idx ON collection USING btree
(template_item_id);
--
-- Name: collection_workflow1_fk_idx; Type: INDEX; Schema: public; Owner:
dspace; Tablespace:
--
CREATE INDEX collection_workflow1_fk_idx ON collection USING btree
(workflow_step_1);
--
-- Name: collection_workflow2_fk_idx; Type: INDEX; Schema: public; Owner:
dspace; Tablespace:
--
CREATE INDEX collection_workflow2_fk_idx ON collection USING btree
(workflow_step_2);
--
-- Name: collection_workflow3_fk_idx; Type: INDEX; Schema: public; Owner:
dspace; Tablespace:
--
CREATE INDEX collection_workflow3_fk_idx ON collection USING btree
(workflow_step_3);
--
-- Name: com2com_child_fk_idx; Type: INDEX; Schema: public; Owner: dspace;
Tablespace:
--
CREATE INDEX com2com_child_fk_idx ON community2community USING btree
(child_comm_id);
--
-- Name: com2com_parent_fk_idx; Type: INDEX; Schema: public; Owner: dspace;
Tablespace:
--
CREATE INDEX com2com_parent_fk_idx ON community2community USING btree
(parent_comm_id);
--
-- Name: comm2item_community_fk_idx; Type: INDEX; Schema: public; Owner:
dspace; Tablespace:
--
CREATE INDEX comm2item_community_fk_idx ON communities2item USING btree
(community_id);
--
-- Name: communities2item_item_id_idx; Type: INDEX; Schema: public; Owner:
dspace; Tablespace:
--
CREATE INDEX communities2item_item_id_idx ON communities2item USING btree
(item_id);
--
-- Name: community2collection_collection_id_idx; Type: INDEX; Schema: public;
Owner: dspace; Tablespace:
--
CREATE INDEX community2collection_collection_id_idx ON community2collection
USING btree (collection_id);
--
-- Name: community2collection_community_id_idx; Type: INDEX; Schema: public;
Owner: dspace; Tablespace:
--
CREATE INDEX community2collection_community_id_idx ON community2collection
USING btree (community_id);
--
-- Name: community_admin_fk_idx; Type: INDEX; Schema: public; Owner: dspace;
Tablespace:
--
CREATE INDEX community_admin_fk_idx ON community USING btree (admin);
--
-- Name: community_logo_fk_idx; Type: INDEX; Schema: public; Owner: dspace;
Tablespace:
--
CREATE INDEX community_logo_fk_idx ON community USING btree (logo_bitstream_id);
--
-- Name: eperson_email_idx; Type: INDEX; Schema: public; Owner: dspace;
Tablespace:
--
CREATE INDEX eperson_email_idx ON eperson USING btree (email);
--
-- Name: epersongroup2eperson_group_idx; Type: INDEX; Schema: public; Owner:
dspace; Tablespace:
--
CREATE INDEX epersongroup2eperson_group_idx ON epersongroup2eperson USING btree
(eperson_group_id);
--
-- Name: epg2ep_eperson_fk_idx; Type: INDEX; Schema: public; Owner: dspace;
Tablespace:
--
CREATE INDEX epg2ep_eperson_fk_idx ON epersongroup2eperson USING btree
(eperson_id);
--
-- Name: epg2wi_group_fk_idx; Type: INDEX; Schema: public; Owner: dspace;
Tablespace:
--
CREATE INDEX epg2wi_group_fk_idx ON epersongroup2workspaceitem USING btree
(eperson_group_id);
--
-- Name: epg2wi_workspace_fk_idx; Type: INDEX; Schema: public; Owner: dspace;
Tablespace:
--
CREATE INDEX epg2wi_workspace_fk_idx ON epersongroup2workspaceitem USING btree
(workspace_item_id);
--
-- Name: fe_bitstream_fk_idx; Type: INDEX; Schema: public; Owner: dspace;
Tablespace:
--
CREATE INDEX fe_bitstream_fk_idx ON fileextension USING btree
(bitstream_format_id);
--
-- Name: g2g_child_fk_idx; Type: INDEX; Schema: public; Owner: dspace;
Tablespace:
--
CREATE INDEX g2g_child_fk_idx ON group2group USING btree (child_id);
--
-- Name: g2g_parent_fk_idx; Type: INDEX; Schema: public; Owner: dspace;
Tablespace:
--
CREATE INDEX g2g_parent_fk_idx ON group2group USING btree (parent_id);
--
-- Name: g2gc_child_fk_idx; Type: INDEX; Schema: public; Owner: dspace;
Tablespace:
--
CREATE INDEX g2gc_child_fk_idx ON group2group USING btree (child_id);
--
-- Name: g2gc_parent_fk_idx; Type: INDEX; Schema: public; Owner: dspace;
Tablespace:
--
CREATE INDEX g2gc_parent_fk_idx ON group2group USING btree (parent_id);
--
-- Name: handle_handle_idx; Type: INDEX; Schema: public; Owner: dspace;
Tablespace:
--
CREATE INDEX handle_handle_idx ON handle USING btree (handle);
--
-- Name: handle_resource_id_and_type_idx; Type: INDEX; Schema: public; Owner:
dspace; Tablespace:
--
CREATE INDEX handle_resource_id_and_type_idx ON handle USING btree
(resource_id, resource_type_id);
--
-- Name: harvested_collection_fk_idx; Type: INDEX; Schema: public; Owner:
dspace; Tablespace:
--
CREATE INDEX harvested_collection_fk_idx ON harvested_collection USING btree
(collection_id);
--
-- Name: harvested_item_fk_idx; Type: INDEX; Schema: public; Owner: dspace;
Tablespace:
--
CREATE INDEX harvested_item_fk_idx ON harvested_item USING btree (item_id);
--
-- Name: item2bundle_bundle_fk_idx; Type: INDEX; Schema: public; Owner: dspace;
Tablespace:
--
CREATE INDEX item2bundle_bundle_fk_idx ON item2bundle USING btree (bundle_id);
--
-- Name: item2bundle_item_idx; Type: INDEX; Schema: public; Owner: dspace;
Tablespace:
--
CREATE INDEX item2bundle_item_idx ON item2bundle USING btree (item_id);
--
-- Name: item_submitter_fk_idx; Type: INDEX; Schema: public; Owner: dspace;
Tablespace:
--
CREATE INDEX item_submitter_fk_idx ON item USING btree (submitter_id);
--
-- Name: metadatafield_schema_idx; Type: INDEX; Schema: public; Owner: dspace;
Tablespace:
--
CREATE INDEX metadatafield_schema_idx ON metadatafieldregistry USING btree
(metadata_schema_id);
--
-- Name: metadatavalue_field_fk_idx; Type: INDEX; Schema: public; Owner:
dspace; Tablespace:
--
CREATE INDEX metadatavalue_field_fk_idx ON metadatavalue USING btree
(metadata_field_id);
--
-- Name: metadatavalue_item_idx; Type: INDEX; Schema: public; Owner: dspace;
Tablespace:
--
CREATE INDEX metadatavalue_item_idx ON metadatavalue USING btree (item_id);
--
-- Name: metadatavalue_item_idx2; Type: INDEX; Schema: public; Owner: dspace;
Tablespace:
--
CREATE INDEX metadatavalue_item_idx2 ON metadatavalue USING btree (item_id,
metadata_field_id);
--
-- Name: mrc_result_fk_idx; Type: INDEX; Schema: public; Owner: dspace;
Tablespace:
--
CREATE INDEX mrc_result_fk_idx ON most_recent_checksum USING btree (result);
--
-- Name: resourcepolicy_type_id_idx; Type: INDEX; Schema: public; Owner:
dspace; Tablespace:
--
CREATE INDEX resourcepolicy_type_id_idx ON resourcepolicy USING btree
(resource_type_id, resource_id);
--
-- Name: rp_eperson_fk_idx; Type: INDEX; Schema: public; Owner: dspace;
Tablespace:
--
CREATE INDEX rp_eperson_fk_idx ON resourcepolicy USING btree (eperson_id);
--
-- Name: rp_epersongroup_fk_idx; Type: INDEX; Schema: public; Owner: dspace;
Tablespace:
--
CREATE INDEX rp_epersongroup_fk_idx ON resourcepolicy USING btree
(epersongroup_id);
--
-- Name: schema_version_ir_idx; Type: INDEX; Schema: public; Owner: dspace;
Tablespace:
--
CREATE INDEX schema_version_ir_idx ON schema_version USING btree
(installed_rank);
--
-- Name: schema_version_s_idx; Type: INDEX; Schema: public; Owner: dspace;
Tablespace:
--
CREATE INDEX schema_version_s_idx ON schema_version USING btree (success);
--
-- Name: schema_version_vr_idx; Type: INDEX; Schema: public; Owner: dspace;
Tablespace:
--
CREATE INDEX schema_version_vr_idx ON schema_version USING btree (version_rank);
--
-- Name: subs_collection_fk_idx; Type: INDEX; Schema: public; Owner: dspace;
Tablespace:
--
CREATE INDEX subs_collection_fk_idx ON subscription USING btree (collection_id);
--
-- Name: subs_eperson_fk_idx; Type: INDEX; Schema: public; Owner: dspace;
Tablespace:
--
CREATE INDEX subs_eperson_fk_idx ON subscription USING btree (eperson_id);
--
-- Name: tasklist_eperson_fk_idx; Type: INDEX; Schema: public; Owner: dspace;
Tablespace:
--
CREATE INDEX tasklist_eperson_fk_idx ON tasklistitem USING btree (eperson_id);
--
-- Name: tasklist_workflow_fk_idx; Type: INDEX; Schema: public; Owner: dspace;
Tablespace:
--
CREATE INDEX tasklist_workflow_fk_idx ON tasklistitem USING btree (workflow_id);
--
-- Name: workflow_coll_fk_idx; Type: INDEX; Schema: public; Owner: dspace;
Tablespace:
--
CREATE INDEX workflow_coll_fk_idx ON workflowitem USING btree (collection_id);
--
-- Name: workflow_item_fk_idx; Type: INDEX; Schema: public; Owner: dspace;
Tablespace:
--
CREATE INDEX workflow_item_fk_idx ON workflowitem USING btree (item_id);
--
-- Name: workflow_owner_fk_idx; Type: INDEX; Schema: public; Owner: dspace;
Tablespace:
--
CREATE INDEX workflow_owner_fk_idx ON workflowitem USING btree (owner);
--
-- Name: workspace_coll_fk_idx; Type: INDEX; Schema: public; Owner: dspace;
Tablespace:
--
CREATE INDEX workspace_coll_fk_idx ON workspaceitem USING btree (collection_id);
--
-- Name: workspace_item_fk_idx; Type: INDEX; Schema: public; Owner: dspace;
Tablespace:
--
CREATE INDEX workspace_item_fk_idx ON workspaceitem USING btree (item_id);
--
-- Name: bitstream_bitstream_format_id_fkey; Type: FK CONSTRAINT; Schema:
public; Owner: dspace
--
ALTER TABLE ONLY bitstream
ADD CONSTRAINT bitstream_bitstream_format_id_fkey FOREIGN KEY
(bitstream_format_id) REFERENCES bitstreamformatregistry(bitstream_format_id);
--
-- Name: bundle2bitstream_bitstream_id_fkey; Type: FK CONSTRAINT; Schema:
public; Owner: dspace
--
ALTER TABLE ONLY bundle2bitstream
ADD CONSTRAINT bundle2bitstream_bitstream_id_fkey FOREIGN KEY
(bitstream_id) REFERENCES bitstream(bitstream_id);
--
-- Name: bundle2bitstream_bundle_id_fkey; Type: FK CONSTRAINT; Schema: public;
Owner: dspace
--
ALTER TABLE ONLY bundle2bitstream
ADD CONSTRAINT bundle2bitstream_bundle_id_fkey FOREIGN KEY (bundle_id)
REFERENCES bundle(bundle_id);
--
-- Name: checksum_history_result_fkey; Type: FK CONSTRAINT; Schema: public;
Owner: dspace
--
ALTER TABLE ONLY checksum_history
ADD CONSTRAINT checksum_history_result_fkey FOREIGN KEY (result) REFERENCES
checksum_results(result_code);
--
-- Name: coll2item_item_fk; Type: FK CONSTRAINT; Schema: public; Owner: dspace
--
ALTER TABLE ONLY collection2item
ADD CONSTRAINT coll2item_item_fk FOREIGN KEY (item_id) REFERENCES
item(item_id) DEFERRABLE;
--
-- Name: collection2item_collection_id_fkey; Type: FK CONSTRAINT; Schema:
public; Owner: dspace
--
ALTER TABLE ONLY collection2item
ADD CONSTRAINT collection2item_collection_id_fkey FOREIGN KEY
(collection_id) REFERENCES collection(collection_id);
--
-- Name: collection_admin_fkey; Type: FK CONSTRAINT; Schema: public; Owner:
dspace
--
ALTER TABLE ONLY collection
ADD CONSTRAINT collection_admin_fkey FOREIGN KEY (admin) REFERENCES
epersongroup(eperson_group_id);
--
-- Name: collection_item_count_collection_id_fkey; Type: FK CONSTRAINT; Schema:
public; Owner: dspace
--
ALTER TABLE ONLY collection_item_count
ADD CONSTRAINT collection_item_count_collection_id_fkey FOREIGN KEY
(collection_id) REFERENCES collection(collection_id);
--
-- Name: collection_logo_bitstream_id_fkey; Type: FK CONSTRAINT; Schema:
public; Owner: dspace
--
ALTER TABLE ONLY collection
ADD CONSTRAINT collection_logo_bitstream_id_fkey FOREIGN KEY
(logo_bitstream_id) REFERENCES bitstream(bitstream_id);
--
-- Name: collection_submitter_fkey; Type: FK CONSTRAINT; Schema: public; Owner:
dspace
--
ALTER TABLE ONLY collection
ADD CONSTRAINT collection_submitter_fkey FOREIGN KEY (submitter) REFERENCES
epersongroup(eperson_group_id);
--
-- Name: collection_template_item_id_fkey; Type: FK CONSTRAINT; Schema: public;
Owner: dspace
--
ALTER TABLE ONLY collection
ADD CONSTRAINT collection_template_item_id_fkey FOREIGN KEY
(template_item_id) REFERENCES item(item_id);
--
-- Name: collection_workflow_step_1_fkey; Type: FK CONSTRAINT; Schema: public;
Owner: dspace
--
ALTER TABLE ONLY collection
ADD CONSTRAINT collection_workflow_step_1_fkey FOREIGN KEY
(workflow_step_1) REFERENCES epersongroup(eperson_group_id);
--
-- Name: collection_workflow_step_2_fkey; Type: FK CONSTRAINT; Schema: public;
Owner: dspace
--
ALTER TABLE ONLY collection
ADD CONSTRAINT collection_workflow_step_2_fkey FOREIGN KEY
(workflow_step_2) REFERENCES epersongroup(eperson_group_id);
--
-- Name: collection_workflow_step_3_fkey; Type: FK CONSTRAINT; Schema: public;
Owner: dspace
--
ALTER TABLE ONLY collection
ADD CONSTRAINT collection_workflow_step_3_fkey FOREIGN KEY
(workflow_step_3) REFERENCES epersongroup(eperson_group_id);
--
-- Name: com2com_child_fk; Type: FK CONSTRAINT; Schema: public; Owner: dspace
--
ALTER TABLE ONLY community2community
ADD CONSTRAINT com2com_child_fk FOREIGN KEY (child_comm_id) REFERENCES
community(community_id) DEFERRABLE;
--
-- Name: comm2coll_collection_fk; Type: FK CONSTRAINT; Schema: public; Owner:
dspace
--
ALTER TABLE ONLY community2collection
ADD CONSTRAINT comm2coll_collection_fk FOREIGN KEY (collection_id)
REFERENCES collection(collection_id) DEFERRABLE;
--
-- Name: communities2item_community_id_fkey; Type: FK CONSTRAINT; Schema:
public; Owner: dspace
--
ALTER TABLE ONLY communities2item
ADD CONSTRAINT communities2item_community_id_fkey FOREIGN KEY
(community_id) REFERENCES community(community_id);
--
-- Name: communities2item_item_id_fkey; Type: FK CONSTRAINT; Schema: public;
Owner: dspace
--
ALTER TABLE ONLY communities2item
ADD CONSTRAINT communities2item_item_id_fkey FOREIGN KEY (item_id)
REFERENCES item(item_id);
--
-- Name: community2collection_community_id_fkey; Type: FK CONSTRAINT; Schema:
public; Owner: dspace
--
ALTER TABLE ONLY community2collection
ADD CONSTRAINT community2collection_community_id_fkey FOREIGN KEY
(community_id) REFERENCES community(community_id);
--
-- Name: community2community_parent_comm_id_fkey; Type: FK CONSTRAINT; Schema:
public; Owner: dspace
--
ALTER TABLE ONLY community2community
ADD CONSTRAINT community2community_parent_comm_id_fkey FOREIGN KEY
(parent_comm_id) REFERENCES community(community_id);
--
-- Name: community_admin_fkey; Type: FK CONSTRAINT; Schema: public; Owner:
dspace
--
ALTER TABLE ONLY community
ADD CONSTRAINT community_admin_fkey FOREIGN KEY (admin) REFERENCES
epersongroup(eperson_group_id);
--
-- Name: community_item_count_community_id_fkey; Type: FK CONSTRAINT; Schema:
public; Owner: dspace
--
ALTER TABLE ONLY community_item_count
ADD CONSTRAINT community_item_count_community_id_fkey FOREIGN KEY
(community_id) REFERENCES community(community_id);
--
-- Name: community_logo_bitstream_id_fkey; Type: FK CONSTRAINT; Schema: public;
Owner: dspace
--
ALTER TABLE ONLY community
ADD CONSTRAINT community_logo_bitstream_id_fkey FOREIGN KEY
(logo_bitstream_id) REFERENCES bitstream(bitstream_id);
--
-- Name: epersongroup2eperson_eperson_group_id_fkey; Type: FK CONSTRAINT;
Schema: public; Owner: dspace
--
ALTER TABLE ONLY epersongroup2eperson
ADD CONSTRAINT epersongroup2eperson_eperson_group_id_fkey FOREIGN KEY
(eperson_group_id) REFERENCES epersongroup(eperson_group_id);
--
-- Name: epersongroup2eperson_eperson_id_fkey; Type: FK CONSTRAINT; Schema:
public; Owner: dspace
--
ALTER TABLE ONLY epersongroup2eperson
ADD CONSTRAINT epersongroup2eperson_eperson_id_fkey FOREIGN KEY
(eperson_id) REFERENCES eperson(eperson_id);
--
-- Name: epersongroup2workspaceitem_eperson_group_id_fkey; Type: FK CONSTRAINT;
Schema: public; Owner: dspace
--
ALTER TABLE ONLY epersongroup2workspaceitem
ADD CONSTRAINT epersongroup2workspaceitem_eperson_group_id_fkey FOREIGN KEY
(eperson_group_id) REFERENCES epersongroup(eperson_group_id);
--
-- Name: epersongroup2workspaceitem_workspace_item_id_fkey; Type: FK
CONSTRAINT; Schema: public; Owner: dspace
--
ALTER TABLE ONLY epersongroup2workspaceitem
ADD CONSTRAINT epersongroup2workspaceitem_workspace_item_id_fkey FOREIGN
KEY (workspace_item_id) REFERENCES workspaceitem(workspace_item_id);
--
-- Name: fileextension_bitstream_format_id_fkey; Type: FK CONSTRAINT; Schema:
public; Owner: dspace
--
ALTER TABLE ONLY fileextension
ADD CONSTRAINT fileextension_bitstream_format_id_fkey FOREIGN KEY
(bitstream_format_id) REFERENCES bitstreamformatregistry(bitstream_format_id);
--
-- Name: group2group_child_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner:
dspace
--
ALTER TABLE ONLY group2group
ADD CONSTRAINT group2group_child_id_fkey FOREIGN KEY (child_id) REFERENCES
epersongroup(eperson_group_id);
--
-- Name: group2group_parent_id_fkey; Type: FK CONSTRAINT; Schema: public;
Owner: dspace
--
ALTER TABLE ONLY group2group
ADD CONSTRAINT group2group_parent_id_fkey FOREIGN KEY (parent_id)
REFERENCES epersongroup(eperson_group_id);
--
-- Name: group2groupcache_child_id_fkey; Type: FK CONSTRAINT; Schema: public;
Owner: dspace
--
ALTER TABLE ONLY group2groupcache
ADD CONSTRAINT group2groupcache_child_id_fkey FOREIGN KEY (child_id)
REFERENCES epersongroup(eperson_group_id);
--
-- Name: group2groupcache_parent_id_fkey; Type: FK CONSTRAINT; Schema: public;
Owner: dspace
--
ALTER TABLE ONLY group2groupcache
ADD CONSTRAINT group2groupcache_parent_id_fkey FOREIGN KEY (parent_id)
REFERENCES epersongroup(eperson_group_id);
--
-- Name: harvested_collection_collection_id_fkey; Type: FK CONSTRAINT; Schema:
public; Owner: dspace
--
ALTER TABLE ONLY harvested_collection
ADD CONSTRAINT harvested_collection_collection_id_fkey FOREIGN KEY
(collection_id) REFERENCES collection(collection_id) ON DELETE CASCADE;
--
-- Name: harvested_item_item_id_fkey; Type: FK CONSTRAINT; Schema: public;
Owner: dspace
--
ALTER TABLE ONLY harvested_item
ADD CONSTRAINT harvested_item_item_id_fkey FOREIGN KEY (item_id) REFERENCES
item(item_id) ON DELETE CASCADE;
--
-- Name: item2bundle_bundle_id_fkey; Type: FK CONSTRAINT; Schema: public;
Owner: dspace
--
ALTER TABLE ONLY item2bundle
ADD CONSTRAINT item2bundle_bundle_id_fkey FOREIGN KEY (bundle_id)
REFERENCES bundle(bundle_id);
--
-- Name: item2bundle_item_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner:
dspace
--
ALTER TABLE ONLY item2bundle
ADD CONSTRAINT item2bundle_item_id_fkey FOREIGN KEY (item_id) REFERENCES
item(item_id);
--
-- Name: item_submitter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner:
dspace
--
ALTER TABLE ONLY item
ADD CONSTRAINT item_submitter_id_fkey FOREIGN KEY (submitter_id) REFERENCES
eperson(eperson_id);
--
-- Name: metadatafieldregistry_metadata_schema_id_fkey; Type: FK CONSTRAINT;
Schema: public; Owner: dspace
--
ALTER TABLE ONLY metadatafieldregistry
ADD CONSTRAINT metadatafieldregistry_metadata_schema_id_fkey FOREIGN KEY
(metadata_schema_id) REFERENCES metadataschemaregistry(metadata_schema_id);
--
-- Name: metadatavalue_item_id_fkey; Type: FK CONSTRAINT; Schema: public;
Owner: dspace
--
ALTER TABLE ONLY metadatavalue
ADD CONSTRAINT metadatavalue_item_id_fkey FOREIGN KEY (item_id) REFERENCES
item(item_id);
--
-- Name: metadatavalue_metadata_field_id_fkey; Type: FK CONSTRAINT; Schema:
public; Owner: dspace
--
ALTER TABLE ONLY metadatavalue
ADD CONSTRAINT metadatavalue_metadata_field_id_fkey FOREIGN KEY
(metadata_field_id) REFERENCES metadatafieldregistry(metadata_field_id);
--
-- Name: most_recent_checksum_bitstream_id_fkey; Type: FK CONSTRAINT; Schema:
public; Owner: dspace
--
ALTER TABLE ONLY most_recent_checksum
ADD CONSTRAINT most_recent_checksum_bitstream_id_fkey FOREIGN KEY
(bitstream_id) REFERENCES bitstream(bitstream_id);
--
-- Name: most_recent_checksum_result_fkey; Type: FK CONSTRAINT; Schema: public;
Owner: dspace
--
ALTER TABLE ONLY most_recent_checksum
ADD CONSTRAINT most_recent_checksum_result_fkey FOREIGN KEY (result)
REFERENCES checksum_results(result_code);
--
-- Name: primary_bitstream_id_fk; Type: FK CONSTRAINT; Schema: public; Owner:
dspace
--
ALTER TABLE ONLY bundle
ADD CONSTRAINT primary_bitstream_id_fk FOREIGN KEY (primary_bitstream_id)
REFERENCES bitstream(bitstream_id);
--
-- Name: resourcepolicy_eperson_id_fkey; Type: FK CONSTRAINT; Schema: public;
Owner: dspace
--
ALTER TABLE ONLY resourcepolicy
ADD CONSTRAINT resourcepolicy_eperson_id_fkey FOREIGN KEY (eperson_id)
REFERENCES eperson(eperson_id);
--
-- Name: resourcepolicy_epersongroup_id_fkey; Type: FK CONSTRAINT; Schema:
public; Owner: dspace
--
ALTER TABLE ONLY resourcepolicy
ADD CONSTRAINT resourcepolicy_epersongroup_id_fkey FOREIGN KEY
(epersongroup_id) REFERENCES epersongroup(eperson_group_id);
--
-- Name: subscription_collection_id_fkey; Type: FK CONSTRAINT; Schema: public;
Owner: dspace
--
ALTER TABLE ONLY subscription
ADD CONSTRAINT subscription_collection_id_fkey FOREIGN KEY (collection_id)
REFERENCES collection(collection_id);
--
-- Name: subscription_eperson_id_fkey; Type: FK CONSTRAINT; Schema: public;
Owner: dspace
--
ALTER TABLE ONLY subscription
ADD CONSTRAINT subscription_eperson_id_fkey FOREIGN KEY (eperson_id)
REFERENCES eperson(eperson_id);
--
-- Name: tasklistitem_eperson_id_fkey; Type: FK CONSTRAINT; Schema: public;
Owner: dspace
--
ALTER TABLE ONLY tasklistitem
ADD CONSTRAINT tasklistitem_eperson_id_fkey FOREIGN KEY (eperson_id)
REFERENCES eperson(eperson_id);
--
-- Name: tasklistitem_workflow_id_fkey; Type: FK CONSTRAINT; Schema: public;
Owner: dspace
--
ALTER TABLE ONLY tasklistitem
ADD CONSTRAINT tasklistitem_workflow_id_fkey FOREIGN KEY (workflow_id)
REFERENCES workflowitem(workflow_id);
--
-- Name: workflowitem_collection_id_fkey; Type: FK CONSTRAINT; Schema: public;
Owner: dspace
--
ALTER TABLE ONLY workflowitem
ADD CONSTRAINT workflowitem_collection_id_fkey FOREIGN KEY (collection_id)
REFERENCES collection(collection_id);
--
-- Name: workflowitem_item_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner:
dspace
--
ALTER TABLE ONLY workflowitem
ADD CONSTRAINT workflowitem_item_id_fkey FOREIGN KEY (item_id) REFERENCES
item(item_id);
--
-- Name: workflowitem_owner_fkey; Type: FK CONSTRAINT; Schema: public; Owner:
dspace
--
ALTER TABLE ONLY workflowitem
ADD CONSTRAINT workflowitem_owner_fkey FOREIGN KEY (owner) REFERENCES
eperson(eperson_id);
--
-- Name: workspaceitem_collection_id_fkey; Type: FK CONSTRAINT; Schema: public;
Owner: dspace
--
ALTER TABLE ONLY workspaceitem
ADD CONSTRAINT workspaceitem_collection_id_fkey FOREIGN KEY (collection_id)
REFERENCES collection(collection_id);
--
-- Name: workspaceitem_item_id_fkey; Type: FK CONSTRAINT; Schema: public;
Owner: dspace
--
ALTER TABLE ONLY workspaceitem
ADD CONSTRAINT workspaceitem_item_id_fkey FOREIGN KEY (item_id) REFERENCES
item(item_id);
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
DSpace-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-tech
List Etiquette: https://wiki.duraspace.org/display/DSPACE/Mailing+List+Etiquette