Skip to content

Commit

Permalink
QA: Add new indexes to upgrade script and fix again
Browse files Browse the repository at this point in the history
  • Loading branch information
TheWitness committed Jan 1, 2025
1 parent fdf5233 commit d930509
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cacti.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2679,7 +2679,7 @@ CREATE TABLE `reports` (
`thumbnails` char(2) NOT NULL default '',
PRIMARY KEY (`id`),
KEY `next_start` (`next_start`),
KEY `last_start` (`last_start`))
KEY `last_started` (`last_started`))
ENGINE=InnoDB
ROW_FORMAT=Dynamic
COMMENT='Cacti Reporting Reports';
Expand Down
19 changes: 12 additions & 7 deletions install/upgrades/1_3_0.php
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,9 @@ function upgrade_reports() {
ADD COLUMN `monthly_day` varchar(45) default NULL AFTER monthly_week,
ADD COLUMN `last_runtime` double NOT NULL default '0' AFTER monthly_day,
ADD COLUMN `last_started` timestamp NOT NULL default '0000-00-00 00:00:00' AFTER last_runtime,
ADD COLUMN `last_status` varchar(128) NOT NULL default '' AFTER last_started");
ADD COLUMN `last_status` varchar(128) NOT NULL default '' AFTER last_started,
ADD INDEX `last_started` (`last_started`),
ADD INDEX `next_start` (`next_start`)");

/* migrate the schedules as close as possible */
$reports = db_fetch_assoc('SELECT * FROM reports');
Expand Down Expand Up @@ -627,7 +629,7 @@ function upgrade_reports() {
SET sched_type = 1,
enabled = "",
next_start = ?,
last_start = ?
last_started = ?
WHERE id = ?',
array(
$r['mailtime'],
Expand All @@ -643,7 +645,7 @@ function upgrade_reports() {
enabled = ?
recur_every = ?,
next_start = ?,
last_start = ?
last_started = ?
WHERE id = ?',
array(
6,
Expand All @@ -663,7 +665,7 @@ function upgrade_reports() {
enabled = ?,
recur_every = ?,
next_start = ?,
last_start = ?
last_started = ?
WHERE id = ?',
array(
$r['intrvl']+1,
Expand All @@ -683,7 +685,7 @@ function upgrade_reports() {
day_of_month = ?,
month = ?,
next_start = ?,
last_start = ?
last_started = ?
WHERE id = ?',
array(
$r['intrvl']+1,
Expand All @@ -705,7 +707,7 @@ function upgrade_reports() {
monthly_week = ?,
month = ?,
next_start = ?,
last_start = ?
last_started = ?
WHERE id = ?',
array(
$r['intrvl']+1,
Expand All @@ -727,7 +729,7 @@ function upgrade_reports() {
SET sched_type = 1,
enabled = "",
next_start = ?,
last_start = ?
last_started = ?
WHERE id = ?',
array(
$r['mailtime'],
Expand All @@ -739,6 +741,9 @@ function upgrade_reports() {
break;
}
}
} else {
db_execute('ALTER TABLE reports DROP COLUMN enabled');
db_execute('ALTER TABLE reports ADD COLUMN enabled char(2) NOT NULL default "" AFTER name');
}

db_execute('ALTER TABLE reports
Expand Down

0 comments on commit d930509

Please sign in to comment.