From 1ffd67e0148160d87866bb7f25bc5513a12b67d2 Mon Sep 17 00:00:00 2001
From: Adam Ierymenko <adam.ierymenko@gmail.com>
Date: Mon, 20 Jul 2015 14:28:30 -0700
Subject: Get rid of false foreign key in Relay.

---
 controller/schema.sql | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

(limited to 'controller/schema.sql')

diff --git a/controller/schema.sql b/controller/schema.sql
index c3eec234..e85785b7 100644
--- a/controller/schema.sql
+++ b/controller/schema.sql
@@ -67,12 +67,11 @@ CREATE INDEX Member_networkId_memberRevision ON Member(networkId, memberRevision
 
 CREATE TABLE Relay (
   networkId char(16) NOT NULL REFERENCES Network(id) ON DELETE CASCADE,
-  nodeId char(10) NOT NULL REFERENCES Node(id) ON DELETE CASCADE,
-  phyAddress varchar(64) NOT NULL,
-  PRIMARY KEY (networkId, nodeId)
+  address char(10) NOT NULL,
+  phyAddress varchar(64) NOT NULL
 );
 
-CREATE INDEX Relay_networkId ON Relay (networkId);
+CREATE UNIQUE INDEX Relay_networkId_address ON Relay (networkId,address);
 
 CREATE TABLE Rule (
   networkId char(16) NOT NULL REFERENCES Network(id) ON DELETE CASCADE,
-- 
cgit v1.2.3

