Skip to content

Commit

Permalink
Merged in DSC-1105 (pull request DSpace#835)
Browse files Browse the repository at this point in the history
[DSC-1105] Align imp framework sequences to pre existing Ids
  • Loading branch information
steph-ieffam committed Nov 15, 2023
2 parents c084ae9 + 5968fcb commit df829f0
Showing 1 changed file with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
--
-- 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 sequences for DBMS Import framework
-----------------------------------------------------------------------------------
do $$
begin

SELECT pg_catalog.setval('imp_record_seq', (SELECT coalesce(MAX(imp_id),0) FROM imp_record)+1);

SELECT pg_catalog.setval('imp_metadatavalue_seq', (SELECT coalesce(MAX(imp_metadatavalue_id),0) FROM imp_metadatavalue)+1);

SELECT pg_catalog.setval('imp_bitstream_seq', (SELECT coalesce(MAX(imp_bitstream_id),0) FROM imp_bitstream)+1);

SELECT pg_catalog.setval('imp_bitstream_metadatavalue_seq', (SELECT coalesce(MAX(imp_bitstream_metadatavalue_id),0) FROM imp_bitstream_metadatavalue)+1);

exception when others then

raise notice 'The transaction is in an uncommittable state. '
'Transaction was rolled back';

raise notice 'Rollback --> % %', SQLERRM, SQLSTATE;
end;
$$ language 'plpgsql';

0 comments on commit df829f0

Please sign in to comment.