From fcc5bf1e6695c9bfa0aff8d69ebe005043397967 Mon Sep 17 00:00:00 2001
From: Adam Ierymenko <adam.ierymenko@gmail.com>
Date: Wed, 29 Jul 2015 15:09:23 -0700
Subject: Go ahead and spec out controller DB support for AuthToken -- GitHub
 issue #211 -- even though full implementation won't make it into 1.0.4.

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

(limited to 'controller/schema.sql')

diff --git a/controller/schema.sql b/controller/schema.sql
index 398d63ac..48d5607c 100644
--- a/controller/schema.sql
+++ b/controller/schema.sql
@@ -17,6 +17,18 @@ CREATE TABLE Network (
   memberRevisionCounter integer NOT NULL DEFAULT(1)
 );
 
+CREATE TABLE AuthToken (
+  id integer PRIMARY KEY NOT NULL,
+  networkId char(16) NOT NULL REFERENCES Network(id) ON DELETE CASCADE,
+  authMode integer NOT NULL DEFAULT(1),
+  useCount integer NOT NULL DEFAULT(0),
+  maxUses integer NOT NULL DEFAULT(0),
+  expiresAt integer NOT NULL DEFAULT(0),
+  token varchar(256) NOT NULL
+);
+
+CREATE INDEX AuthToken_networkId_token ON AuthToken(networkId,token);
+
 CREATE TABLE Node (
   id char(10) PRIMARY KEY NOT NULL,
   identity varchar(4096) NOT NULL
@@ -70,6 +82,7 @@ CREATE TABLE Log (
   nodeId char(10) NOT NULL,
   ts integer NOT NULL,
   authorized integer NOT NULL,
+  authTokenId integer,
   version varchar(16),
   fromAddr varchar(64)
 );
-- 
cgit v1.2.3

