Don't call UNIX_TIMESTAMP when sorting by host_last_state_change

Else possible indices can't be used.
This commit is contained in:
Eric Lippmann 2017-07-27 15:03:12 +02:00 committed by Eric Lippmann
parent 3a1afb3511
commit e7776d08a9
2 changed files with 5 additions and 0 deletions

View File

@ -78,6 +78,7 @@ class HoststatusQuery extends IdoQuery
'host_last_hard_state_change' => 'UNIX_TIMESTAMP(hs.last_hard_state_change)',
'host_last_notification' => 'UNIX_TIMESTAMP(hs.last_notification)',
'host_last_state_change' => 'UNIX_TIMESTAMP(hs.last_state_change)',
'host_last_state_change_ts' => 'hs.last_state_change',
'host_last_time_down' => 'UNIX_TIMESTAMP(hs.last_time_down)',
'host_last_time_unreachable' => 'UNIX_TIMESTAMP(hs.last_time_unreachable)',
'host_last_time_up' => 'UNIX_TIMESTAMP(hs.last_time_up)',

View File

@ -40,6 +40,7 @@ class HostStatus extends DataView
'host_last_check',
'host_last_notification',
'host_last_state_change',
'host_last_state_change_ts',
'host_long_output',
'host_max_check_attempts',
'host_modified_host_attributes',
@ -119,6 +120,9 @@ class HostStatus extends DataView
'order' => self::SORT_ASC
),
'host_last_state_change' => array(
'columns' => array(
'host_last_state_change_ts'
),
'order' => self::SORT_DESC
)
);