From f8eb6b00674a218cef20fd2ad6803fdecabc82ab Mon Sep 17 00:00:00 2001
From: Adam Ierymenko <adam.ierymenko@gmail.com>
Date: Wed, 3 Feb 2016 13:56:35 -0800
Subject: Add NodeHistory table on sqlite controller.

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

(limited to 'controller/schema.sql')

diff --git a/controller/schema.sql b/controller/schema.sql
index b6db7fa4..c40e5cac 100644
--- a/controller/schema.sql
+++ b/controller/schema.sql
@@ -34,6 +34,20 @@ CREATE TABLE Node (
   identity varchar(4096) NOT NULL
 );
 
+CREATE TABLE NodeHistory (
+  nodeId char(10) NOT NULL REFERENCES Node(id) ON DELETE CASCADE,
+  networkId char(16) NOT NULL REFERENCES Network(id) ON DELETE CASCADE,
+  networkVisitCounter INTEGER NOT NULL DEFAULT(0),
+  networkRequestAuthorized INTEGER NOT NULL DEFAULT(0),
+  requestTime INTEGER NOT NULL DEFAULT(0),
+  networkRequestMetaData VARCHAR(1024),
+  fromAddress VARCHAR(128)
+);
+
+CREATE INDEX NodeHistory_nodeId ON NodeHistory (nodeId);
+CREATE INDEX NodeHistory_networkId ON NodeHistory (networkId);
+CREATE INDEX NodeHistory_requestTime ON NodeHistory (requestTime);
+
 CREATE TABLE Gateway (
   networkId char(16) NOT NULL REFERENCES Network(id) ON DELETE CASCADE,
   ip blob(16) NOT NULL,
-- 
cgit v1.2.3

