]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/sql/Pg/upgrade/0421.schema.embiggen-ints.sql
LP#1564079 Checkout history skips nonexistent items
[Evergreen.git] / Open-ILS / src / sql / Pg / upgrade / 0421.schema.embiggen-ints.sql
1 -- 1. Turn some ints into bigints.
2
3 -- 2. Rename a constraint for consistency and accuracy (currently it may
4 -- have either of two different names).
5
6 \qecho One of the following DROPs will fail, so we do them
7 \qecho both outside of a transaction.  Ignore the failure.
8
9 ALTER TABLE booking.resource_type
10         DROP CONSTRAINT brt_name_or_record_once_per_owner;
11
12 ALTER TABLE booking.resource_type
13         DROP CONSTRAINT brt_name_once_per_owner;
14
15 BEGIN;
16
17 INSERT INTO config.upgrade_log (version) VALUES ('0421'); -- Scott McKellar
18
19 ALTER TABLE booking.resource_type
20         ALTER COLUMN record SET DATA TYPE bigint,
21         ADD CONSTRAINT brt_name_and_record_once_per_owner UNIQUE(owner, name, record);
22
23 ALTER TABLE container.biblio_record_entry_bucket_item
24         ALTER COLUMN target_biblio_record_entry SET DATA TYPE bigint;
25
26 -- Before we can embiggen the next one, we must drop a view
27 -- that depends on it (and recreate it later)
28
29 DROP VIEW IF EXISTS acq.acq_lineitem_lifecycle;
30
31 ALTER TABLE acq.lineitem
32         ALTER COLUMN eg_bib_id SET DATA TYPE bigint;
33
34 -- Recreate the view
35
36 SELECT acq.create_acq_lifecycle( 'acq', 'lineitem' );
37
38 ALTER TABLE vandelay.queued_bib_record
39         ALTER COLUMN imported_as SET DATA TYPE bigint;
40
41 ALTER TABLE action.hold_copy_map
42         ALTER COLUMN id SET DATA TYPE bigint;
43
44 COMMIT;