From: Galen Charlton Date: Thu, 12 Aug 2021 20:05:56 +0000 (-0400) Subject: LP#1813191: stamp DB update X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=003bd7f0323b2e359d7330701985413aad6d6a69;p=evergreen%2Ftadl.git LP#1813191: stamp DB update Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index 9cd06181f0..2b9698820a 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -92,7 +92,7 @@ CREATE TRIGGER no_overlapping_deps BEFORE INSERT OR UPDATE ON config.db_patch_dependencies FOR EACH ROW EXECUTE PROCEDURE evergreen.array_overlap_check ('deprecates'); -INSERT INTO config.upgrade_log (version, applied_to) VALUES ('1277', :eg_version); -- gmcharlt/rfrasur/berick +INSERT INTO config.upgrade_log (version, applied_to) VALUES ('1278', :eg_version); -- JBoyer/terranm/gmcharlt CREATE TABLE config.bib_source ( id SERIAL PRIMARY KEY, diff --git a/Open-ILS/src/sql/Pg/upgrade/1278.schema.dewey_ranges.sql b/Open-ILS/src/sql/Pg/upgrade/1278.schema.dewey_ranges.sql new file mode 100644 index 0000000000..7016261ebb --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/1278.schema.dewey_ranges.sql @@ -0,0 +1,30 @@ +BEGIN; + +SELECT evergreen.upgrade_deps_block_check('1278', :eg_version); + +CREATE OR REPLACE VIEW reporter.asset_call_number_dewey AS + SELECT id AS call_number, + call_number_dewey(label) AS dewey, + CASE WHEN call_number_dewey(label) ~ '^[0-9]+\.?[0-9]*$'::text + THEN btrim(to_char(10::double precision * floor(call_number_dewey(label)::double precision / 10::double precision), '000'::text)) + ELSE NULL::text + END AS dewey_block_tens, + CASE WHEN call_number_dewey(label) ~ '^[0-9]+\.?[0-9]*$'::text + THEN btrim(to_char(100::double precision * floor(call_number_dewey(label)::double precision / 100::double precision), '000'::text)) + ELSE NULL::text + END AS dewey_block_hundreds, + CASE WHEN call_number_dewey(label) ~ '^[0-9]+\.?[0-9]*$'::text + THEN (btrim(to_char(10::double precision * floor(call_number_dewey(label)::double precision / 10::double precision), '000'::text)) || '-'::text) + || btrim(to_char(10::double precision * floor(call_number_dewey(label)::double precision / 10::double precision) + 9::double precision, '000'::text)) + ELSE NULL::text + END AS dewey_range_tens, + CASE WHEN call_number_dewey(label) ~ '^[0-9]+\.?[0-9]*$'::text + THEN (btrim(to_char(100::double precision * floor(call_number_dewey(label)::double precision / 100::double precision), '000'::text)) || '-'::text) + || btrim(to_char(100::double precision * floor(call_number_dewey(label)::double precision / 100::double precision) + 99::double precision, '000'::text)) + ELSE NULL::text + END AS dewey_range_hundreds + FROM asset.call_number + WHERE call_number_dewey(label) ~ '^[0-9]'::text; + +COMMIT; + diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.dewey_ranges.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.dewey_ranges.sql deleted file mode 100644 index a2a6a8c5ad..0000000000 --- a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.dewey_ranges.sql +++ /dev/null @@ -1,30 +0,0 @@ -BEGIN; - -SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version); - -CREATE OR REPLACE VIEW reporter.asset_call_number_dewey AS - SELECT id AS call_number, - call_number_dewey(label) AS dewey, - CASE WHEN call_number_dewey(label) ~ '^[0-9]+\.?[0-9]*$'::text - THEN btrim(to_char(10::double precision * floor(call_number_dewey(label)::double precision / 10::double precision), '000'::text)) - ELSE NULL::text - END AS dewey_block_tens, - CASE WHEN call_number_dewey(label) ~ '^[0-9]+\.?[0-9]*$'::text - THEN btrim(to_char(100::double precision * floor(call_number_dewey(label)::double precision / 100::double precision), '000'::text)) - ELSE NULL::text - END AS dewey_block_hundreds, - CASE WHEN call_number_dewey(label) ~ '^[0-9]+\.?[0-9]*$'::text - THEN (btrim(to_char(10::double precision * floor(call_number_dewey(label)::double precision / 10::double precision), '000'::text)) || '-'::text) - || btrim(to_char(10::double precision * floor(call_number_dewey(label)::double precision / 10::double precision) + 9::double precision, '000'::text)) - ELSE NULL::text - END AS dewey_range_tens, - CASE WHEN call_number_dewey(label) ~ '^[0-9]+\.?[0-9]*$'::text - THEN (btrim(to_char(100::double precision * floor(call_number_dewey(label)::double precision / 100::double precision), '000'::text)) || '-'::text) - || btrim(to_char(100::double precision * floor(call_number_dewey(label)::double precision / 100::double precision) + 99::double precision, '000'::text)) - ELSE NULL::text - END AS dewey_range_hundreds - FROM asset.call_number - WHERE call_number_dewey(label) ~ '^[0-9]'::text; - -COMMIT; -