'tables' => [
'host_info_err' => [
'sql' => "SELECT * FROM host_info WHERE 0=1"
- ." OR key LIKE '%.exit_code' AND val<> '0'"
+ ." OR (key LIKE '%.exit_code' AND val<> '0')"
,
]
],
-DROP TABLE IF EXISTS host;
+DROP VIEW IF EXISTS host;
CREATE VIEW host AS
- SELECT host,LEFT(CAST(MAX(updated) AS TEXT),19) as updated
+ SELECT host
+ ,LEFT(CAST(MAX(updated) AS TEXT),19) as updated
+ ,count(*) as infos
+ ,array_to_string(array_agg(DISTINCT CASE WHEN key LIKE 'git.%.branch' THEN val ELSE null END),' ') as branches
FROM host_info
GROUP BY host
;