From 0315e430ceaa05938209ad0745e4b5e0fa5d15c5 Mon Sep 17 00:00:00 2001 From: Chris Sharp Date: Wed, 7 Oct 2020 15:38:34 -0400 Subject: [PATCH] LP1893463: Follow-up to address de-duplication and adding release notes. Signed-off-by: Chris Sharp Signed-off-by: Jason Stephenson --- .../upgrade/1241.schema.reporter_schedule_uniqueness.sql | 14 ++++++++++++++ .../Reports/deduplicated_reports_schedule.adoc | 5 +++++ 2 files changed, 19 insertions(+) create mode 100644 docs/RELEASE_NOTES_NEXT/Reports/deduplicated_reports_schedule.adoc diff --git a/Open-ILS/src/sql/Pg/upgrade/1241.schema.reporter_schedule_uniqueness.sql b/Open-ILS/src/sql/Pg/upgrade/1241.schema.reporter_schedule_uniqueness.sql index 0d9e4b757a..934aa76ede 100644 --- a/Open-ILS/src/sql/Pg/upgrade/1241.schema.reporter_schedule_uniqueness.sql +++ b/Open-ILS/src/sql/Pg/upgrade/1241.schema.reporter_schedule_uniqueness.sql @@ -2,6 +2,20 @@ BEGIN; SELECT evergreen.upgrade_deps_block_check('1241', :eg_version); +SET CONSTRAINTS ALL IMMEDIATE; -- to address "pending trigger events" error + +-- Dedupe the table before applying the script. Preserve the original to allow the admin to delete it manually later. +CREATE TABLE reporter.schedule_original (LIKE reporter.schedule); +INSERT INTO reporter.schedule_original SELECT * FROM reporter.schedule; +TRUNCATE reporter.schedule; +INSERT INTO reporter.schedule (SELECT DISTINCT ON (report, folder, runner, run_time, email) id, report, folder, runner, run_time, start_time, complete_time, email, excel_format, html_format, csv_format, chart_pie, chart_bar, chart_line, error_code, error_text FROM reporter.schedule_original); +\qecho NOTE: This has created a backup of the original reporter.schedule +\qecho table, named reporter.schedule_original. Once you are sure that everything +\qecho works as expected, you can delete that table by issuing the following: +\qecho +\qecho 'DROP TABLE reporter.schedule_original;' +\qecho + -- Explicitly supply the name because it is referenced in clark-kent.pl CREATE UNIQUE INDEX rpt_sched_recurrence_once_idx ON reporter.schedule (report,folder,runner,run_time,email); diff --git a/docs/RELEASE_NOTES_NEXT/Reports/deduplicated_reports_schedule.adoc b/docs/RELEASE_NOTES_NEXT/Reports/deduplicated_reports_schedule.adoc new file mode 100644 index 0000000000..0d80b10a8e --- /dev/null +++ b/docs/RELEASE_NOTES_NEXT/Reports/deduplicated_reports_schedule.adoc @@ -0,0 +1,5 @@ +Reports Scheduler Improvements +^^^^^^^^^^^^^ +Previously, the reports scheduler allowed duplicated reports +under certain circumstances. A uniqueness constraint now +disallows this without adversely affecting the reports process. -- 2.11.0