use Data::Dumper;
-use OpenSRF::Utils::JSON;
-
use Time::HiRes qw(time);
use OpenSRF::EX qw(:try);
use Digest::MD5 qw(md5_hex);
use OpenILS::Const qw/:const/;
use OpenILS::Application::AppUtils;
-my $apputils = "OpenILS::Application::AppUtils";
-my $U = $apputils;
+my $U = "OpenILS::Application::AppUtils";
my $pfx = "open-ils.search_";
if ($_->summary_method ne 'use_sre_only') {
if (ref $_->basic_summary) { #TODO: 'show-generated' boolean on summaries
if ($_->basic_summary->generated_coverage) {
- push(@{$svr->basic_holdings}, $_->basic_summary->generated_coverage);
+ push(@{$svr->basic_holdings}, OpenSRF::Utils::JSON->JSON2perl($_->basic_summary->generated_coverage));
}
if ($_->basic_summary->textual_holdings) {
push(@{$svr->basic_holdings_add}, $_->basic_summary->textual_holdings);
}
if (ref $_->supplement_summary) {
if ($_->supplement_summary->generated_coverage) {
- push(@{$svr->supplement_holdings}, $_->supplement_summary->generated_coverage);
+ push(@{$svr->supplement_holdings}, OpenSRF::Utils::JSON->JSON2perl($_->supplement_summary->generated_coverage));
}
if ($_->supplement_summary->textual_holdings) {
push(@{$svr->supplement_holdings_add}, $_->supplement_summary->textual_holdings);
}
if (ref $_->index_summary) {
if ($_->index_summary->generated_coverage) {
- push(@{$svr->index_holdings}, $_->index_summary->generated_coverage);
+ push(@{$svr->index_holdings}, OpenSRF::Utils::JSON->JSON2perl($_->index_summary->generated_coverage));
}
if ($_->index_summary->textual_holdings) {
push(@{$svr->index_holdings_add}, $_->index_summary->textual_holdings);
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 ('0542', :eg_version); -- phasefx
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0543', :eg_version); -- dbwells
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
--- /dev/null
+BEGIN;
+
+-- Reformat generated_coverage to be JSON arrays rather than simple comma-
+-- separated lists.
+
+-- This upgrade script is technically imperfect, but should do the right thing
+-- in 99.9% of cases, and any mistakes will be self-healing as more serials
+-- activity happens
+
+SELECT evergreen.upgrade_deps_block_check('0543', :eg_version); -- dbwells
+
+UPDATE serial.basic_summary SET generated_coverage = '["' || regexp_replace(regexp_replace(generated_coverage, '"', E'\\"', 'g'), ', ', '","', 'g') || '"]' WHERE generated_coverage <> '';
+
+UPDATE serial.supplement_summary SET generated_coverage = '["' || regexp_replace(regexp_replace(generated_coverage, '"', E'\\"', 'g'), ', ', '","', 'g') || '"]' WHERE generated_coverage <> '';
+
+UPDATE serial.index_summary SET generated_coverage = '["' || regexp_replace(regexp_replace(generated_coverage, '"', E'\\"', 'g'), ', ', '","', 'g') || '"]' WHERE generated_coverage <> '';
+
+COMMIT;