IDO: Provide comment name column

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

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

View File

@ -23,6 +23,7 @@ class CommentQuery extends IdoQuery
'comment_expiration' => 'c.comment_expiration',
'comment_internal_id' => 'c.comment_internal_id',
'comment_is_persistent' => 'c.comment_is_persistent',
'comment_name' => 'c.comment_name',
'comment_timestamp' => 'c.comment_timestamp',
'comment_type' => 'c.comment_type',
'instance_name' => 'c.instance_name',
@ -85,6 +86,9 @@ class CommentQuery extends IdoQuery
*/
protected function joinBaseTables()
{
if (version_compare($this->getIdoVersion(), '1.14.0', '<')) {
$this->columnMap['comments']['comment_name'] = '(NULL)';
}
$this->commentQuery = $this->db->select();
$this->select->from(
array('c' => $this->commentQuery),

View File

@ -34,6 +34,7 @@ class HostcommentQuery extends IdoQuery
'comment_expiration' => 'CASE c.expires WHEN 1 THEN UNIX_TIMESTAMP(c.expiration_time) ELSE NULL END',
'comment_internal_id' => 'c.internal_comment_id',
'comment_is_persistent' => 'c.is_persistent',
'comment_name' => 'c.name',
'comment_timestamp' => 'UNIX_TIMESTAMP(c.comment_time)',
'comment_type' => "CASE c.entry_type WHEN 1 THEN 'comment' WHEN 2 THEN 'downtime' WHEN 3 THEN 'flapping' WHEN 4 THEN 'ack' END",
'host' => 'ho.name1 COLLATE latin1_general_ci',
@ -72,6 +73,9 @@ class HostcommentQuery extends IdoQuery
*/
protected function joinBaseTables()
{
if (version_compare($this->getIdoVersion(), '1.14.0', '<')) {
$this->columnMap['comments']['comment_name'] = '(NULL)';
}
$this->select->from(
array('c' => $this->prefix . 'comments'),
array()

View File

@ -34,6 +34,7 @@ class ServicecommentQuery extends IdoQuery
'comment_expiration' => 'CASE c.expires WHEN 1 THEN UNIX_TIMESTAMP(c.expiration_time) ELSE NULL END',
'comment_internal_id' => 'c.internal_comment_id',
'comment_is_persistent' => 'c.is_persistent',
'comment_name' => 'c.name',
'comment_timestamp' => 'UNIX_TIMESTAMP(c.comment_time)',
'comment_type' => "CASE c.entry_type WHEN 1 THEN 'comment' WHEN 2 THEN 'downtime' WHEN 3 THEN 'flapping' WHEN 4 THEN 'ack' END",
'host' => 'so.name1 COLLATE latin1_general_ci',
@ -77,6 +78,9 @@ class ServicecommentQuery extends IdoQuery
*/
protected function joinBaseTables()
{
if (version_compare($this->getIdoVersion(), '1.14.0', '<')) {
$this->columnMap['comments']['comment_name'] = '(NULL)';
}
$this->select->from(
array('c' => $this->prefix . 'comments'),
array()

View File

@ -19,6 +19,7 @@ class Comment extends DataView
'comment_expiration',
'comment_internal_id',
'comment_is_persistent',
'comment_name',
'comment_timestamp',
'comment_type',
'host_display_name',

View File

@ -20,6 +20,7 @@ class Hostcomment extends DataView
'comment_expiration',
'comment_internal_id',
'comment_is_persistent',
'comment_name',
'comment_timestamp',
'comment_type',
'host_display_name',

View File

@ -20,6 +20,7 @@ class Servicecomment extends DataView
'comment_expiration',
'comment_internal_id',
'comment_is_persistent',
'comment_name',
'comment_timestamp',
'comment_type',
'host_display_name',