Skip to content

Commit

Permalink
Merge pull request #11061 from IQSS/10714-access-requests-missing-sin…
Browse files Browse the repository at this point in the history
…ce-upgrade-v6-0

sql script/flyway to fix file access requests
  • Loading branch information
ofahimIQSS authored Jan 17, 2025
2 parents a6e36f6 + f56dc6b commit 69ebed2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
### Flyway Script added to Fix File Access Requests when upgrading from Dataverse 6.0

Database update script added to prevent duplicate keys when upgrading from V6.0
This script will delete access requests made after the initial request and will set the initial request to "Created"

See: https://github.com/IQSS/dataverse/issues/10714
10 changes: 10 additions & 0 deletions src/main/resources/db/migration/V6.5.0.2.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-- Fixes File Access Requests when upgrading from Dataverse 6.0
-- See: https://github.com/IQSS/dataverse/issues/10714
DELETE FROM fileaccessrequests
WHERE creation_time <> (SELECT MIN(creation_time)
FROM fileaccessrequests far2
WHERE far2.datafile_id = fileaccessrequests.datafile_id
AND far2.authenticated_user_id = fileaccessrequests.authenticated_user_id
AND far2.request_state is NULL);

UPDATE fileaccessrequests SET request_state='CREATED' WHERE request_state is NULL;

0 comments on commit 69ebed2

Please sign in to comment.