IDO: Provide downtime name column

The Icinga 2 API requires the downtimes's name when removing the downtime.

refs #11398
This commit is contained in:
Eric Lippmann 2016-08-31 12:59:39 +02:00
parent 0e307c6482
commit c55c5a9e64
6 changed files with 15 additions and 0 deletions

View File

@ -27,6 +27,7 @@ class DowntimeQuery extends IdoQuery
'downtime_is_fixed' => 'd.downtime_is_fixed',
'downtime_is_flexible' => 'd.downtime_is_flexible',
'downtime_is_in_effect' => 'd.downtime_is_in_effect',
'downtime_name' => 'd.downtime_name',
'downtime_scheduled_end' => 'd.downtime_scheduled_end',
'downtime_scheduled_start' => 'd.downtime_scheduled_start',
'downtime_start' => 'd.downtime_start',
@ -90,6 +91,9 @@ class DowntimeQuery extends IdoQuery
*/
protected function joinBaseTables()
{
if (version_compare($this->getIdoVersion(), '1.14.0', '<')) {
$this->columnMap['downtimes']['downtime_name'] = '(NULL)';
}
$this->downtimeQuery = $this->db->select();
$this->select->from(
array('d' => $this->downtimeQuery),

View File

@ -38,6 +38,7 @@ class HostdowntimeQuery extends IdoQuery
'downtime_is_fixed' => 'sd.is_fixed',
'downtime_is_flexible' => 'CASE WHEN sd.is_fixed = 0 THEN 1 ELSE 0 END',
'downtime_is_in_effect' => 'sd.is_in_effect',
'downtime_name' => 'sd.name',
'downtime_scheduled_end' => 'UNIX_TIMESTAMP(sd.scheduled_end_time)',
'downtime_scheduled_start' => 'UNIX_TIMESTAMP(sd.scheduled_start_time)',
'downtime_start' => 'UNIX_TIMESTAMP(CASE WHEN UNIX_TIMESTAMP(sd.trigger_time) > 0 then sd.trigger_time ELSE sd.scheduled_start_time END)',
@ -78,6 +79,9 @@ class HostdowntimeQuery extends IdoQuery
*/
protected function joinBaseTables()
{
if (version_compare($this->getIdoVersion(), '1.14.0', '<')) {
$this->columnMap['downtimes']['downtime_name'] = '(NULL)';
}
$this->select->from(
array('sd' => $this->prefix . 'scheduleddowntime'),
array()

View File

@ -38,6 +38,7 @@ class ServicedowntimeQuery extends IdoQuery
'downtime_is_fixed' => 'sd.is_fixed',
'downtime_is_flexible' => 'CASE WHEN sd.is_fixed = 0 THEN 1 ELSE 0 END',
'downtime_is_in_effect' => 'sd.is_in_effect',
'downtime_name' => 'sd.name',
'downtime_scheduled_end' => 'UNIX_TIMESTAMP(sd.scheduled_end_time)',
'downtime_scheduled_start' => 'UNIX_TIMESTAMP(sd.scheduled_start_time)',
'downtime_start' => 'UNIX_TIMESTAMP(CASE WHEN UNIX_TIMESTAMP(sd.trigger_time) > 0 then sd.trigger_time ELSE sd.scheduled_start_time END)',
@ -83,6 +84,9 @@ class ServicedowntimeQuery extends IdoQuery
*/
protected function joinBaseTables()
{
if (version_compare($this->getIdoVersion(), '1.14.0', '<')) {
$this->columnMap['downtimes']['downtime_name'] = '(NULL)';
}
$this->select->from(
array('sd' => $this->prefix . 'scheduleddowntime'),
array()

View File

@ -23,6 +23,7 @@ class Downtime extends DataView
'downtime_is_fixed',
'downtime_is_flexible',
'downtime_is_in_effect',
'downtime_name',
'downtime_scheduled_end',
'downtime_scheduled_start',
'downtime_start',

View File

@ -24,6 +24,7 @@ class Hostdowntime extends DataView
'downtime_is_fixed',
'downtime_is_flexible',
'downtime_is_in_effect',
'downtime_name',
'downtime_scheduled_end',
'downtime_scheduled_start',
'downtime_start',

View File

@ -21,6 +21,7 @@ class Servicedowntime extends DataView
'downtime_is_fixed',
'downtime_is_flexible',
'downtime_is_in_effect',
'downtime_name',
'downtime_scheduled_end',
'downtime_scheduled_start',
'downtime_start',