WHERE id = ?;
SQL
- $logger->debug('Report SQL: ' . $r->{resultset}->toSQL);
+ $logger->debug('Report SQL: ' . $r->{resultset}->toSQL);
$sth = $data_dbh->prepare($r->{resultset}->toSQL);
$sth->execute;
VALUES ( ?, ?, ?, ?::TIMESTAMPTZ + ?, ?, ?, ?, ?, ?, ?, ? );
SQL
- $state_dbh->do(
+ my $prevP = $state_dbh->{PrintError};
+ $state_dbh->{PrintError} = 0;
+ if (!$state_dbh->do(
$sql,
{},
$r->{report}->{id},
$r->{chart_pie},
$r->{chart_bar},
$r->{chart_line},
- );
+ )) {
+ # Ignore duplicate key errors on reporter.schedule (err 7 is a fatal query error). Just look for the constraint name in the message to avoid l10n issues.
+ warn($state_dbh->errstr()) unless $state_dbh->err() == 7 && $state_dbh->errstr() =~ m/rpt_sched_recurrence_once_idx/;
+ }
+ $state_dbh->{PrintError} = $prevP;
}
$state_dbh->do(<<' SQL',{}, $r->{id});
);
CREATE INDEX rpt_sched_runner_idx ON reporter.schedule (runner);
CREATE INDEX rpt_sched_folder_idx ON reporter.schedule (folder);
+CREATE UNIQUE INDEX rpt_sched_recurrence_once_idx ON reporter.schedule (report,folder,runner,run_time,email);
CREATE OR REPLACE VIEW reporter.simple_record AS
SELECT r.id,
--- /dev/null
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+-- 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);
+
+COMMIT;
+