From e2a2993b186c521f9521d1a9adeb150d27c15629 Mon Sep 17 00:00:00 2001
From: Adam Ierymenko <adam.ierymenko@gmail.com>
Date: Wed, 22 Jul 2015 14:01:49 -0700
Subject: Add a Log table to log queries for debugging and security logging. No
 JSON API support for querying the log yet, but will probably come via
 /network/###/member/###/log/... or something.

---
 controller/schema.sql | 11 +++++++++++
 1 file changed, 11 insertions(+)

(limited to 'controller/schema.sql')

diff --git a/controller/schema.sql b/controller/schema.sql
index e85785b7..024a5229 100644
--- a/controller/schema.sql
+++ b/controller/schema.sql
@@ -65,6 +65,17 @@ CREATE TABLE Member (
 CREATE INDEX Member_networkId_activeBridge ON Member(networkId, activeBridge);
 CREATE INDEX Member_networkId_memberRevision ON Member(networkId, memberRevision);
 
+CREATE TABLE Log (
+  networkId char(16) NOT NULL,
+  nodeId char(10) NOT NULL,
+  ts integer NOT NULL,
+  authorized integer NOT NULL,
+  fromAddr varchar(64)
+);
+
+CREATE INDEX Log_networkId_nodeId ON Log(networkId, nodeId);
+CREATE INDEX Log_ts ON Log(ts);
+
 CREATE TABLE Relay (
   networkId char(16) NOT NULL REFERENCES Network(id) ON DELETE CASCADE,
   address char(10) NOT NULL,
-- 
cgit v1.2.3

