DowntimeQuery: Postgres fixes

Change is_fixed to boolean check and illegal postgres timerange of
'0000-00-00 00:00:00'.

refs #5896
This commit is contained in:
Marius Hein 2014-08-29 11:37:20 +02:00
parent 751d2e6d11
commit e46dd4bdfd
1 changed files with 2 additions and 2 deletions

View File

@ -23,8 +23,8 @@ class DowntimeQuery extends IdoQuery
'downtime_triggered_by_id' => 'sd.triggered_by_id', 'downtime_triggered_by_id' => 'sd.triggered_by_id',
'downtime_scheduled_start' => 'UNIX_TIMESTAMP(sd.scheduled_start_time)', 'downtime_scheduled_start' => 'UNIX_TIMESTAMP(sd.scheduled_start_time)',
'downtime_scheduled_end' => 'UNIX_TIMESTAMP(sd.scheduled_end_time)', 'downtime_scheduled_end' => 'UNIX_TIMESTAMP(sd.scheduled_end_time)',
'downtime_start' => "UNIX_TIMESTAMP(CASE WHEN sd.trigger_time != '0000-00-00 00:00:00' then sd.trigger_time ELSE sd.scheduled_start_time END)", 'downtime_start' => "UNIX_TIMESTAMP(CASE WHEN UNIX_TIMESTAMP(sd.trigger_time) > 0 then sd.trigger_time ELSE sd.scheduled_start_time END)",
'downtime_end' => 'CASE WHEN sd.is_fixed THEN UNIX_TIMESTAMP(sd.scheduled_end_time) ELSE UNIX_TIMESTAMP(sd.trigger_time) + sd.duration END', 'downtime_end' => 'CASE WHEN sd.is_fixed > 0 THEN UNIX_TIMESTAMP(sd.scheduled_end_time) ELSE UNIX_TIMESTAMP(sd.trigger_time) + sd.duration END',
'downtime_duration' => 'sd.duration', 'downtime_duration' => 'sd.duration',
'downtime_is_in_effect' => 'sd.is_in_effect', 'downtime_is_in_effect' => 'sd.is_in_effect',
'downtime_internal_id' => 'sd.internal_downtime_id', 'downtime_internal_id' => 'sd.internal_downtime_id',