-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #599 from thoth-pub/feature/545_zenodo_location
- Loading branch information
Showing
4 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
UPDATE location SET location_platform = 'Other' WHERE location_platform = 'Zenodo'; | ||
|
||
-- Drop the default and unique constraint, otherwise it won't be able to cast to text | ||
ALTER TABLE location ALTER COLUMN location_platform DROP DEFAULT; | ||
DROP INDEX location_uniq_platform_idx; | ||
|
||
ALTER TABLE location ALTER COLUMN location_platform TYPE text; | ||
DROP TYPE location_platform; | ||
CREATE TYPE location_platform AS ENUM ( | ||
'Project MUSE', | ||
'OAPEN', | ||
'DOAB', | ||
'JSTOR', | ||
'EBSCO Host', | ||
'OCLC KB', | ||
'ProQuest KB', | ||
'ProQuest ExLibris', | ||
'EBSCO KB', | ||
'JISC KB', | ||
'Google Books', | ||
'Internet Archive', | ||
'ScienceOpen', | ||
'SciELO Books', | ||
'Publisher Website', | ||
'Other' | ||
); | ||
ALTER TABLE location ALTER location_platform TYPE location_platform USING location_platform::location_platform; | ||
ALTER TABLE location | ||
ALTER COLUMN location_platform SET DEFAULT 'Other'::location_platform; | ||
|
||
CREATE UNIQUE INDEX location_uniq_platform_idx | ||
ON location (publication_id, location_platform) | ||
WHERE NOT location_platform = 'Other'::location_platform; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ALTER TYPE location_platform ADD VALUE IF NOT EXISTS 'Zenodo'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters