LP#902255: Protect against hold double-capture
[working/Evergreen.git] / Open-ILS / src / sql / Pg / upgrade / XXXX.schema.disallow-double-capture.sql
1 BEGIN;
2
3 SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
4
5 CREATE UNIQUE INDEX CONCURRENTLY
6     hold_request_capture_protect_idx ON action.hold_request (current_copy)
7     WHERE   current_copy IS NOT NULL -- sometimes null in old/bad data
8             AND capture_time IS NOT NULL
9             AND cancel_time IS NULL
10             AND fulfillment_time IS NULL;
11
12 COMMIT;
13