Changed the constraint on the biblio.monograph_part table to allow for a
monograph part to be created if a duplicate deleted version is found.
To test:
[1] Add a monograph part to a bib.
[2] Delete that monograph part.
[3] Attempt to add a monograph part to the same bib using
the same part label. Without the patches installed, this
will fail; upon applying the database update, this operation
should succeed.
Signed-off-by: Steven Callender <stevecallender@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlcstaff.org>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
--- /dev/null
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+ALTER TABLE biblio.monograph_part DROP CONSTRAINT "record_label_unique";
+CREATE UNIQUE INDEX CONCURRENTLY record_label_unique_idx ON biblio.monograph_part (record, label) WHERE deleted = FALSE;
+
+COMMIT;