Skip to content

Commit b2c51c8

Browse files
committed
Merge branch 'release/v0.12.9'
2 parents 66e2d59 + b746617 commit b2c51c8

71 files changed

Lines changed: 3402 additions & 620 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [[0.12.9]](https://github.com/thoth-pub/thoth/releases/tag/v0.12.9) - 2024-09-06
10+
### Added
11+
- [595](https://github.com/thoth-pub/thoth/issues/595), [626](https://github.com/thoth-pub/thoth/pull/626) - Remove infrequently used and unused work statuses (unspecified, no longer our product, out of stock indefinitely, out of print, inactive, unknown, remaindered, recalled). Require a publication date for active, withdrawn, and superseded works in Thoth. Add a new `Superseded` work status to replace Out of Print for older editions of Works. Require a withdrawn date for Superseded works.
12+
- [582](https://github.com/thoth-pub/thoth/issues/582) - Add Crossmark metadata in Crossref DOI deposit when a Crossmark policy is present in the publisher record. Add Crossmark update new\_edition metadata when a book is replaced by a new edition, and withdrawal metadata when a book is withdrawn from sale.
13+
- [574](https://github.com/thoth-pub/thoth/issues/574), [626](https://github.com/thoth-pub/thoth/pull/626) - Add descriptions to all remaining items in schema
14+
15+
### Fixed
16+
- [548](https://github.com/thoth-pub/thoth/issues/548) - Prevent users from deleting contributors/institutions which are linked to works by other publishers
17+
18+
### Changed
19+
- [623](https://github.com/thoth-pub/thoth/pull/623) - Convert connection pool errors (`r2d2::Error`) to `ThothError`
20+
- [625](https://github.com/thoth-pub/thoth/pull/625) - Use relationcode 13 for physical ISBNs in ONIX 2.1 EBSCOHost output
21+
922
## [[0.12.8]](https://github.com/thoth-pub/thoth/releases/tag/v0.12.8) - 2024-09-03
1023
### Fixed
1124
- [622](https://github.com/thoth-pub/thoth/pull/622) - Fix bug where list of contributors in New/Edit Contribution form was truncated

Cargo.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "thoth"
3-
version = "0.12.8"
3+
version = "0.12.9"
44
authors = ["Javier Arias <javi@openbookpublishers.com>", "Ross Higman <ross@openbookpublishers.com>"]
55
edition = "2021"
66
license = "Apache-2.0"
@@ -16,11 +16,11 @@ maintenance = { status = "actively-developed" }
1616
members = ["thoth-api", "thoth-api-server", "thoth-app", "thoth-app-server", "thoth-client", "thoth-errors", "thoth-export-server"]
1717

1818
[dependencies]
19-
thoth-api = { version = "=0.12.8", path = "thoth-api", features = ["backend"] }
20-
thoth-api-server = { version = "=0.12.8", path = "thoth-api-server" }
21-
thoth-app-server = { version = "=0.12.8", path = "thoth-app-server" }
22-
thoth-errors = { version = "=0.12.8", path = "thoth-errors" }
23-
thoth-export-server = { version = "=0.12.8", path = "thoth-export-server" }
19+
thoth-api = { version = "=0.12.9", path = "thoth-api", features = ["backend"] }
20+
thoth-api-server = { version = "=0.12.9", path = "thoth-api-server" }
21+
thoth-app-server = { version = "=0.12.9", path = "thoth-app-server" }
22+
thoth-errors = { version = "=0.12.9", path = "thoth-errors" }
23+
thoth-export-server = { version = "=0.12.9", path = "thoth-export-server" }
2424
clap = { version = "4.5.16", features = ["cargo", "env"] }
2525
dialoguer = { version = "0.11.0", features = ["password"] }
2626
dotenv = "0.15.0"

thoth-api-server/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "thoth-api-server"
3-
version = "0.12.8"
3+
version = "0.12.9"
44
authors = ["Javier Arias <javi@openbookpublishers.com>", "Ross Higman <ross@openbookpublishers.com>"]
55
edition = "2021"
66
license = "Apache-2.0"
@@ -9,8 +9,8 @@ repository = "https://github.com/thoth-pub/thoth"
99
readme = "README.md"
1010

1111
[dependencies]
12-
thoth-api = { version = "=0.12.8", path = "../thoth-api", features = ["backend"] }
13-
thoth-errors = { version = "=0.12.8", path = "../thoth-errors" }
12+
thoth-api = { version = "=0.12.9", path = "../thoth-api", features = ["backend"] }
13+
thoth-errors = { version = "=0.12.9", path = "../thoth-errors" }
1414
actix-web = "4.9"
1515
actix-cors = "0.7.0"
1616
actix-identity = "0.7.1"

thoth-api/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "thoth-api"
3-
version = "0.12.8"
3+
version = "0.12.9"
44
authors = ["Javier Arias <javi@openbookpublishers.com>", "Ross Higman <ross@openbookpublishers.com>"]
55
edition = "2021"
66
license = "Apache-2.0"
@@ -16,7 +16,7 @@ maintenance = { status = "actively-developed" }
1616
backend = ["diesel", "diesel-derive-enum", "diesel_migrations", "futures", "actix-web", "jsonwebtoken"]
1717

1818
[dependencies]
19-
thoth-errors = { version = "=0.12.8", path = "../thoth-errors" }
19+
thoth-errors = { version = "=0.12.9", path = "../thoth-errors" }
2020
actix-web = { version = "4.8", optional = true }
2121
argon2rs = "0.2.5"
2222
isbn2 = "0.4.0"
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
ALTER TYPE work_status RENAME VALUE 'withdrawn' TO 'withdrawn-from-sale';
2+
3+
ALTER TABLE work
4+
-- Drop constraints originally from v0.12.3,
5+
-- otherwise it won't be able to cast to text
6+
DROP CONSTRAINT IF EXISTS work_inactive_no_withdrawn_date_check,
7+
DROP CONSTRAINT IF EXISTS work_active_withdrawn_date_check,
8+
-- Drop new constraint from v.0.12.9
9+
DROP CONSTRAINT IF EXISTS work_active_publication_date_check;
10+
11+
ALTER TABLE work ALTER COLUMN work_status TYPE text;
12+
13+
-- !!! if this down migration is run, 'out-of-print' should
14+
-- be treated as a placeholder work_status.
15+
-- Works will need to be manually reassigned correct work_status:
16+
-- out-of-print, out-of-stock-indefinitely, or inactive
17+
-- This needs to be run because superseded is a new work_status
18+
-- that is removed in this down migration.
19+
UPDATE work
20+
SET work_status = 'out-of-print'
21+
WHERE work_status = 'superseded';
22+
23+
DROP TYPE work_status;
24+
25+
CREATE TYPE work_status AS ENUM (
26+
'unspecified',
27+
'cancelled',
28+
'forthcoming',
29+
'postponed-indefinitely',
30+
'active',
31+
'no-longer-our-product',
32+
'out-of-stock-indefinitely',
33+
'out-of-print',
34+
'inactive',
35+
'unknown',
36+
'remaindered',
37+
'withdrawn-from-sale',
38+
'recalled'
39+
);
40+
41+
ALTER TABLE work ALTER COLUMN work_status TYPE work_status USING work_status::work_status;
42+
43+
-- add constraints back to work table
44+
ALTER TABLE work
45+
ADD CONSTRAINT work_active_withdrawn_date_check CHECK
46+
((work_status = 'withdrawn-from-sale' OR work_status = 'out-of-print')
47+
OR (work_status NOT IN ('withdrawn-from-sale', 'out-of-print') AND withdrawn_date IS NULL)),
48+
49+
ADD CONSTRAINT work_inactive_no_withdrawn_date_check CHECK
50+
(((work_status = 'withdrawn-from-sale' OR work_status = 'out-of-print') AND withdrawn_date IS NOT NULL)
51+
OR (work_status NOT IN ('withdrawn-from-sale', 'out-of-print')));
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
ALTER TYPE work_status RENAME VALUE 'withdrawn-from-sale' TO 'withdrawn';
2+
3+
-- Assign 1900-01-01 as placeholder publication_date for
4+
-- Active, withdrawn from sale, out of print, out of stock indefinitely works with no publication date
5+
-- Required for work_active_publication_date_check constraint below
6+
-- Affected works in production db with this status, 29-05-2024: 59 works (incl. chapters)
7+
-- Before running migration, make a list of affected works
8+
-- After running migration, publishers should be notified to add correct publication_date
9+
-- !!! This is irreversible
10+
UPDATE work
11+
SET
12+
publication_date = '1900-01-01'
13+
WHERE
14+
work_status IN
15+
('active', 'withdrawn', 'out-of-print', 'out-of-stock-indefinitely', 'inactive')
16+
AND publication_date IS NULL;
17+
18+
-- Drop constraints, otherwise it won't be able to cast to text
19+
ALTER TABLE work
20+
DROP CONSTRAINT IF EXISTS work_active_withdrawn_date_check,
21+
DROP CONSTRAINT IF EXISTS work_inactive_no_withdrawn_date_check;
22+
23+
ALTER TABLE work ALTER COLUMN work_status TYPE text;
24+
25+
-- delete unused work_status enum
26+
DROP TYPE work_status;
27+
28+
-- Assign out of print/inactive/out of stock indefinitely works work_status 'superseded'
29+
-- current counts in production db as of 29-05-2024:
30+
-- 145 works (incl. chapters)
31+
-- Before running migration, make a list of affected works
32+
-- After running migration, publishers should be notified to add correct work_status
33+
-- and remove withdrawn_date as necessary. Many OBP "out of print" works are actually first editions
34+
-- for which superseded is the correct new work_status.
35+
-- !!! This is irreversible
36+
UPDATE work
37+
SET
38+
work_status = 'superseded',
39+
-- assign a withdrawn_date, which is required for superseded works
40+
withdrawn_date = CASE
41+
WHEN withdrawn_date IS NOT NULL THEN withdrawn_date
42+
-- + INTERVAL '1 day' is necessary because at least one work has publication_date on
43+
-- the same day as updated_at, but updated_at has a timestamp, so it's
44+
-- greater than. Which then throws an error with the
45+
-- work_withdrawn_date_after_publication_date_check constraint.
46+
WHEN withdrawn_date IS NULL AND publication_date + INTERVAL '1 day' < updated_at THEN updated_at
47+
ELSE CURRENT_DATE
48+
END
49+
WHERE
50+
work_status = 'out-of-print'
51+
OR work_status = 'out-of-stock-indefinitely'
52+
OR work_status = 'inactive';
53+
54+
-- Assign unspecified/unkown works work_status 'forthcoming'
55+
-- current counts in production db as of 29-05-2024:
56+
-- unspecified, 0 works
57+
-- unknown, 0 works
58+
-- !!! This is irreversible
59+
UPDATE work
60+
SET work_status = 'forthcoming'
61+
WHERE work_status = 'unspecified' OR work_status = 'unknown';
62+
63+
-- Assign no longer our product/remaindered/recalled works work_status 'withdrawn-from-sale'
64+
-- current counts in production db as of 29-05-2024:
65+
-- no-longer-our-product, 0 works
66+
-- remaindered, 0 works
67+
-- recalled, 0 works
68+
-- !!! This is irreversible
69+
UPDATE work
70+
SET
71+
work_status = 'withdrawn',
72+
withdrawn_date = COALESCE(withdrawn_date, updated_at)
73+
WHERE
74+
work_status = 'no-longer-our-product'
75+
OR work_status = 'remaindered'
76+
OR work_status = 'recalled';
77+
78+
-- create new work_status enum, adds superseded
79+
CREATE TYPE work_status AS ENUM (
80+
'cancelled',
81+
'forthcoming',
82+
'postponed-indefinitely',
83+
'active',
84+
'withdrawn',
85+
'superseded'
86+
);
87+
ALTER TABLE work ALTER COLUMN work_status TYPE work_status USING work_status::work_status;
88+
89+
-- add new constraints (with same names as in v0.12.3) to work table
90+
ALTER TABLE work
91+
-- withdrawn and superseded works must have withdrawn_date
92+
-- note that this constraint has the same name as migration from v.0.12.3,
93+
-- but changes previous constraint by adding superseded alongside withdrawn
94+
ADD CONSTRAINT work_inactive_no_withdrawn_date_check CHECK
95+
(((work_status = 'withdrawn' OR work_status = 'superseded') AND withdrawn_date IS NOT NULL)
96+
OR (work_status NOT IN ('withdrawn', 'superseded'))),
97+
-- all other work statuses must not have withdrawn_date; see above, adds superseded
98+
ADD CONSTRAINT work_active_withdrawn_date_check CHECK
99+
((work_status = 'withdrawn' OR work_status = 'superseded')
100+
OR (work_status NOT IN ('withdrawn', 'superseded') AND withdrawn_date IS NULL)),
101+
-- active, withdrawn-from-sale, and superseded works must have publication_date
102+
ADD CONSTRAINT work_active_publication_date_check CHECK
103+
((work_status IN ('active', 'withdrawn', 'superseded') AND publication_date IS NOT NULL)
104+
OR (work_status NOT IN ('active', 'withdrawn', 'superseded')));

0 commit comments

Comments
 (0)