From dda9ef2ae7971bceaa792e328c8489cb0695b77e Mon Sep 17 00:00:00 2001
From: Trygve Laugstøl <trygvis@inamo.no>
Date: Mon, 16 Nov 2015 18:46:56 +0100
Subject: core: o Adding device_status table containing the latest device
 status. mqtt: o Listening on $SYS/broker/log, parse out messages about
 clients connecting and disconnecting and store in database.

---
 migrations/sqls/20151115192327-device-online-up.sql | 10 ++++++++++
 1 file changed, 10 insertions(+)
 create mode 100644 migrations/sqls/20151115192327-device-online-up.sql

(limited to 'migrations/sqls/20151115192327-device-online-up.sql')

diff --git a/migrations/sqls/20151115192327-device-online-up.sql b/migrations/sqls/20151115192327-device-online-up.sql
new file mode 100644
index 0000000..bd80a63
--- /dev/null
+++ b/migrations/sqls/20151115192327-device-online-up.sql
@@ -0,0 +1,10 @@
+DROP TABLE IF EXISTS device_status;
+CREATE UNLOGGED TABLE device_status(
+  device      BIGINT PRIMARY KEY REFERENCES device,
+  online      BOOLEAN NOT NULL,
+  timestamp   TIMESTAMPTZ NOT NULL,
+  host        VARCHAR(1000)
+);
+
+INSERT INTO device_status(device, online, timestamp)
+SELECT id, false, created_timestamp FROM device;
-- 
cgit v1.2.3

