-
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 #649 from thoth-pub/feature/648_create_thoth_locat…
…ion_platform Feature/648 create thoth location platform
- Loading branch information
Showing
4 changed files
with
49 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,34 @@ | ||
UPDATE location SET location_platform = 'Other' WHERE location_platform = 'Thoth'; | ||
|
||
-- 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', | ||
'Zenodo', | ||
'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 'Thoth'; |
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