From c8aea152e8843d1d570b15ea29dfe830f50a07cb Mon Sep 17 00:00:00 2001 From: Kyle Huckins Date: Tue, 27 Nov 2018 23:21:15 +0000 Subject: [PATCH] LP#1806968 Vandelay record_type sql fix - Change record_type to TEXT rather than an enum, constrained with the option of "authority" or "bib" Signed-off-by: Kyle Huckins Changes to be committed: modified: Open-ILS/src/sql/Pg/012.schema.vandelay.sql new file: Open-ILS/src/sql/Pg/upgrade/XXXX.schema.vandelay-record-type-fix.sql Signed-off-by: Bill Erickson Signed-off-by: Jason Boyer --- Open-ILS/src/sql/Pg/012.schema.vandelay.sql | 7 +++++-- .../Pg/upgrade/XXXX.schema.vandelay-record-type-fix.sql | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/XXXX.schema.vandelay-record-type-fix.sql diff --git a/Open-ILS/src/sql/Pg/012.schema.vandelay.sql b/Open-ILS/src/sql/Pg/012.schema.vandelay.sql index 6f482763a9..1f53ad17d3 100644 --- a/Open-ILS/src/sql/Pg/012.schema.vandelay.sql +++ b/Open-ILS/src/sql/Pg/012.schema.vandelay.sql @@ -2272,7 +2272,7 @@ CREATE TABLE vandelay.session_tracker ( ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, -- bib/auth - record_type vandelay.bib_queue_queue_type NOT NULL DEFAULT 'bib', + record_type TEXT NOT NULL DEFAULT 'bib', -- Queue defines the source of the data, it does not necessarily -- mean that an action is being performed against an entire queue. @@ -2300,7 +2300,10 @@ CREATE TABLE vandelay.session_tracker ( CHECK (state IN ('active','error','complete')), CONSTRAINT vand_tracker_valid_action_type - CHECK (action_type IN ('upload', 'enqueue', 'import')) + CHECK (action_type IN ('upload', 'enqueue', 'import')), + + CONSTRAINT vand_tracker_valid_record_type + CHECK (record_type IN ('bib', 'authority')) ); COMMIT; diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.vandelay-record-type-fix.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.vandelay-record-type-fix.sql new file mode 100644 index 0000000000..1187011783 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.vandelay-record-type-fix.sql @@ -0,0 +1,16 @@ +BEGIN; + +SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version); + + +ALTER TABLE vandelay.session_tracker + ALTER COLUMN record_type TYPE TEXT; + +ALTER TABLE vandelay.session_tracker + ADD CONSTRAINT vand_tracker_valid_record_type + CHECK (record_type IN ('bib', 'authority')); + +END; +$$ LANGUAGE plpgsql; + +COMMIT; \ No newline at end of file -- 2.11.0