From 151f2403dec93d32199afea4ceff9833b8980cf4 Mon Sep 17 00:00:00 2001
From: Kristian Lyngstol <kly@kly.no>
Date: Thu, 17 Mar 2016 21:31:14 +0000
Subject: NMS: Update schema to "final" version

---
 nms/nms-dump.sql | 52 +++++++++++++++++++++++++++++-----------------------
 1 file changed, 29 insertions(+), 23 deletions(-)

(limited to 'nms/nms-dump.sql')

diff --git a/nms/nms-dump.sql b/nms/nms-dump.sql
index c123554..1480827 100644
--- a/nms/nms-dump.sql
+++ b/nms/nms-dump.sql
@@ -272,18 +272,17 @@ SET default_tablespace = '';
 SET default_with_oids = false;
 
 --
--- Name: dhcp; Type: TABLE; Schema: public; Owner: nms; Tablespace: 
+-- Name: dhcp; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
 --
 
 CREATE TABLE dhcp (
-    switch integer NOT NULL,
-    network cidr NOT NULL,
-    last_ack timestamp without time zone,
-    owner_color character varying
+    switch integer,
+    "time" timestamp without time zone,
+    mac macaddr
 );
 
 
-ALTER TABLE dhcp OWNER TO nms;
+ALTER TABLE dhcp OWNER TO postgres;
 
 --
 -- Name: linknet_ping; Type: TABLE; Schema: public; Owner: nms; Tablespace: 
@@ -492,7 +491,8 @@ CREATE TABLE switches (
     secondary_ip inet,
     placement box,
     subnet4 cidr,
-    subnet6 cidr
+    subnet6 cidr,
+    distro character varying
 );
 
 
@@ -581,6 +581,20 @@ ALTER TABLE ONLY switches
     ADD CONSTRAINT switches_sysname_key1 UNIQUE (sysname);
 
 
+--
+-- Name: dhcp_switch; Type: INDEX; Schema: public; Owner: postgres; Tablespace: 
+--
+
+CREATE INDEX dhcp_switch ON dhcp USING btree (switch);
+
+
+--
+-- Name: dhcp_time; Type: INDEX; Schema: public; Owner: postgres; Tablespace: 
+--
+
+CREATE INDEX dhcp_time ON dhcp USING btree ("time");
+
+
 --
 -- Name: ping_index; Type: INDEX; Schema: public; Owner: nms; Tablespace: 
 --
@@ -658,13 +672,6 @@ CREATE INDEX snmp_time6 ON snmp USING btree ("time" DESC, switch);
 CREATE INDEX switch_temp_index ON switch_temp USING btree (switch);
 
 
---
--- Name: switches_dhcp; Type: INDEX; Schema: public; Owner: nms; Tablespace: 
---
-
-CREATE UNIQUE INDEX switches_dhcp ON dhcp USING btree (switch);
-
-
 --
 -- Name: switches_switch; Type: INDEX; Schema: public; Owner: nms; Tablespace: 
 --
@@ -686,6 +693,14 @@ CREATE INDEX updated_index2 ON linknet_ping USING btree ("time");
 CREATE INDEX updated_index3 ON ping_secondary_ip USING btree ("time");
 
 
+--
+-- Name: dhcp_switch_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
+--
+
+ALTER TABLE ONLY dhcp
+    ADD CONSTRAINT dhcp_switch_fkey FOREIGN KEY (switch) REFERENCES switches(switch);
+
+
 --
 -- Name: snmp_switch_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
 --
@@ -728,15 +743,6 @@ GRANT ALL ON SCHEMA public TO postgres;
 GRANT ALL ON SCHEMA public TO PUBLIC;
 
 
---
--- Name: dhcp; Type: ACL; Schema: public; Owner: nms
---
-
-REVOKE ALL ON TABLE dhcp FROM PUBLIC;
-REVOKE ALL ON TABLE dhcp FROM nms;
-GRANT ALL ON TABLE dhcp TO nms;
-
-
 --
 -- Name: seen_mac; Type: ACL; Schema: public; Owner: nms
 --
-- 
cgit v1.2.3

