]> git.nbdom.net Git - nb.git/commitdiff
/opt/nb/lib/postgres/host.sql
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 18 Mar 2019 04:33:30 +0000 (04:33 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 18 Mar 2019 04:33:30 +0000 (04:33 +0000)
etc/dbq/data.php
lib/postgres/host.sql

index 8aec03d4380eda7d0df1dbb3c1deeea7f74836f9..b61f0dde39b750199ad23c62902a0b1eb847faee 100644 (file)
@@ -4,7 +4,7 @@ $DBQ['data'] = [
        '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')"
                                        ,
                        ]
        ],
index d161990dbfecdbc056d4a7fdb60605549f5ef76f..65e5323ff4c3e8209e2bba4dbbedd475f53457ac 100644 (file)
@@ -1,6 +1,9 @@
-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
 ;