LP1893463: Follow-up to address de-duplication and adding release notes.
authorChris Sharp <csharp@georgialibraries.org>
Wed, 7 Oct 2020 19:38:34 +0000 (15:38 -0400)
committerChris Sharp <csharp@georgialibraries.org>
Thu, 8 Oct 2020 18:32:45 +0000 (14:32 -0400)
Signed-off-by: Chris Sharp <csharp@georgialibraries.org>
Signed-off-by: Jason Stephenson <jason@sigio.com>

Open-ILS/src/sql/Pg/upgrade/1241.schema.reporter_schedule_uniqueness.sql
docs/RELEASE_NOTES_NEXT/Reports/deduplicated_reports_schedule.adoc [new file with mode: 0644]

index 0d9e4b7..934aa76 100644 (file)
@@ -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 (file)
index 0000000..0d80b10
--- /dev/null
@@ -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.