2. Rename the uniqueness constraint for booking.resource_type.
M Open-ILS/src/sql/Pg/090.schema.action.sql
M Open-ILS/src/sql/Pg/200.schema.acq.sql
M Open-ILS/src/sql/Pg/012.schema.vandelay.sql
M Open-ILS/src/sql/Pg/095.schema.booking.sql
M Open-ILS/src/sql/Pg/002.schema.config.sql
M Open-ILS/src/sql/Pg/070.schema.container.sql
A Open-ILS/src/sql/Pg/upgrade/0421.schema.embiggen-ints.sql
git-svn-id: svn://svn.open-ils.org/ILS/trunk@18054
dcc99617-32d9-48b4-a31d-
7c20da2025e4
install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
);
-INSERT INTO config.upgrade_log (version) VALUES ('0420'); -- miker
+INSERT INTO config.upgrade_log (version) VALUES ('0421'); -- Scott McKellar
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
CREATE TABLE vandelay.queued_bib_record (
queue INT NOT NULL REFERENCES vandelay.bib_queue (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
bib_source INT REFERENCES config.bib_source (id) DEFERRABLE INITIALLY DEFERRED,
- imported_as INT REFERENCES biblio.record_entry (id) DEFERRABLE INITIALLY DEFERRED
+ imported_as BIGINT REFERENCES biblio.record_entry (id) DEFERRABLE INITIALLY DEFERRED
) INHERITS (vandelay.queued_record);
ALTER TABLE vandelay.queued_bib_record ADD PRIMARY KEY (id);
CREATE INDEX queued_bib_record_queue_idx ON vandelay.queued_bib_record (queue);
ON UPDATE CASCADE
DEFERRABLE
INITIALLY DEFERRED,
- target_biblio_record_entry INT NOT NULL
+ target_biblio_record_entry BIGINT NOT NULL
REFERENCES biblio.record_entry (id)
ON DELETE CASCADE
ON UPDATE CASCADE
CREATE INDEX ahn_notify_staff_idx ON action.hold_notification ( notify_staff );
CREATE TABLE action.hold_copy_map (
- id SERIAL PRIMARY KEY,
+ id BIGSERIAL PRIMARY KEY,
hold INT NOT NULL REFERENCES action.hold_request (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
target_copy BIGINT NOT NULL, -- REFERENCES asset.copy (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, -- XXX could be an serial.issuance
CONSTRAINT copy_once_per_hold UNIQUE (hold,target_copy)
DEFERRABLE INITIALLY DEFERRED,
catalog_item BOOLEAN NOT NULL DEFAULT FALSE,
transferable BOOLEAN NOT NULL DEFAULT FALSE,
- record INT REFERENCES biblio.record_entry (id)
+ record BIGINT REFERENCES biblio.record_entry (id)
DEFERRABLE INITIALLY DEFERRED,
- CONSTRAINT brt_name_once_per_owner UNIQUE(owner, name, record)
+ CONSTRAINT brt_name_and_record_once_per_owner UNIQUE(owner, name, record)
);
CREATE TABLE booking.resource (
create_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
edit_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
marc TEXT NOT NULL,
- eg_bib_id INT REFERENCES biblio.record_entry (id) DEFERRABLE INITIALLY DEFERRED,
+ eg_bib_id BIGINT REFERENCES biblio.record_entry (id) DEFERRABLE INITIALLY DEFERRED,
source_label TEXT,
state TEXT NOT NULL DEFAULT 'new',
cancel_reason INT REFERENCES acq.cancel_reason( id )
--- /dev/null
+-- 1. Turn some ints into bigints.
+
+-- 2. Rename a constraint for consistency and accuracy (currently it may
+-- have either of two different names).
+
+\qecho One of the following DROPs will fail, so we do them
+\qecho both outside of a transaction. Ignore the failure.
+
+ALTER TABLE booking.resource_type
+ DROP CONSTRAINT brt_name_or_record_once_per_owner;
+
+ALTER TABLE booking.resource_type
+ DROP CONSTRAINT brt_name_once_per_owner;
+
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0421'); -- Scott McKellar
+
+ALTER TABLE booking.resource_type
+ ALTER COLUMN record SET DATA TYPE bigint,
+ ADD CONSTRAINT brt_name_and_record_once_per_owner UNIQUE(owner, name, record);
+
+ALTER TABLE container.biblio_record_entry_bucket_item
+ ALTER COLUMN target_biblio_record_entry SET DATA TYPE bigint;
+
+-- Before we can embiggen the next one, we must drop a view
+-- that depends on it (and recreate it later)
+
+DROP VIEW IF EXISTS acq.acq_lineitem_lifecycle;
+
+ALTER TABLE acq.lineitem
+ ALTER COLUMN eg_bib_id SET DATA TYPE bigint;
+
+-- Recreate the view
+
+SELECT acq.create_acq_lifecycle( 'acq', 'lineitem' );
+
+ALTER TABLE vandelay.queued_bib_record
+ ALTER COLUMN imported_as SET DATA TYPE bigint;
+
+ALTER TABLE action.hold_copy_map
+ ALTER COLUMN id SET DATA TYPE bigint;
+
+COMMIT;