DependencyNode: Cast boolenum to int where applicable

PostgreSQL doesn't like mixing different types with COALESCE()
This commit is contained in:
Johannes Meyer 2025-01-15 14:16:32 +01:00
parent 1eb1e72b6d
commit 8d39fa30d9

View file

@ -56,11 +56,11 @@ class DependencyNode extends Model
['service.display_name', 'host.display_name', 'redundancy_group.display_name']
),
'severity' => new Expression(
'COALESCE(%s, %s, %s)',
"COALESCE(%s, %s, CASE WHEN %s = 'y' THEN 1 ELSE 0 END)",
['service.state.severity', 'host.state.severity', 'redundancy_group.state.failed']
),
'state' => new Expression(
'COALESCE(%s, %s, %s)',
"COALESCE(%s, %s, CASE WHEN %s = 'y' THEN 1 ELSE 0 END)",
['service.state.soft_state', 'host.state.soft_state', 'redundancy_group.state.failed']
),
'last_state_change' => new Expression(