1 | CREATE DATABASE ipdb;
|
---|
2 |
|
---|
3 | \connect ipdb ipdb
|
---|
4 |
|
---|
5 | CREATE TABLE "customers" (
|
---|
6 | "custid" character varying(16) DEFAULT '' NOT NULL,
|
---|
7 | "name" character varying(64),
|
---|
8 | "street" character varying(25),
|
---|
9 | "street2" character varying(25),
|
---|
10 | "city" character varying(30),
|
---|
11 | "province" character(2),
|
---|
12 | "pocode" character varying(7),
|
---|
13 | "phone" character varying(15),
|
---|
14 | "abuse" character varying(50),
|
---|
15 | "def_rdns" character varying(40),
|
---|
16 | "description" text,
|
---|
17 | Constraint "customers_pkey" Primary Key ("custid")
|
---|
18 | );
|
---|
19 |
|
---|
20 | REVOKE ALL on "customers" from PUBLIC;
|
---|
21 | GRANT ALL on "customers" to "kdeugau";
|
---|
22 | GRANT ALL on "customers" to "ipdb";
|
---|
23 |
|
---|
24 | CREATE TABLE "masterblocks" (
|
---|
25 | "cidr" cidr DEFAULT '255.255.255.255/32' NOT NULL PRIMARY KEY
|
---|
26 | );
|
---|
27 |
|
---|
28 | REVOKE ALL on "masterblocks" from PUBLIC;
|
---|
29 | GRANT ALL on "masterblocks" to "kdeugau";
|
---|
30 | GRANT ALL on "masterblocks" to "ipdb";
|
---|
31 |
|
---|
32 | CREATE TABLE "routed" (
|
---|
33 | "cidr" cidr DEFAULT '255.255.255.255/32' NOT NULL PRIMARY KEY,
|
---|
34 | "maskbits" integer DEFAULT 128,
|
---|
35 | "city" character varying(30) DEFAULT ''
|
---|
36 | );
|
---|
37 |
|
---|
38 | REVOKE ALL on "routed" from PUBLIC;
|
---|
39 | GRANT ALL on "routed" to "kdeugau";
|
---|
40 | GRANT ALL on "routed" to "ipdb";
|
---|
41 |
|
---|
42 | CREATE TABLE "temp" (
|
---|
43 | "ofs" integer
|
---|
44 | );
|
---|
45 |
|
---|
46 | REVOKE ALL on "temp" from PUBLIC;
|
---|
47 | GRANT ALL on "temp" to "kdeugau";
|
---|
48 | GRANT ALL on "temp" to "ipdb";
|
---|
49 |
|
---|
50 | CREATE TABLE "freeblocks" (
|
---|
51 | "cidr" cidr DEFAULT '255.255.255.255/32' NOT NULL PRIMARY KEY,
|
---|
52 | "maskbits" integer DEFAULT 128,
|
---|
53 | "city" character varying(30) DEFAULT '',
|
---|
54 | "routed" character(1) DEFAULT 'n'
|
---|
55 | );
|
---|
56 |
|
---|
57 | REVOKE ALL on "freeblocks" from PUBLIC;
|
---|
58 | GRANT ALL on "freeblocks" to "kdeugau";
|
---|
59 | GRANT ALL on "freeblocks" to "ipdb";
|
---|
60 |
|
---|
61 | CREATE TABLE "poolips" (
|
---|
62 | "pool" cidr DEFAULT '255.255.255.255/32' NOT NULL,
|
---|
63 | "ip" cidr DEFAULT '255.255.255.255/32' NOT NULL PRIMARY KEY,
|
---|
64 | "custid" character varying(16) DEFAULT '' NOT NULL,
|
---|
65 | "city" character varying(30) DEFAULT '' NOT NULL,
|
---|
66 | "type" character(2) DEFAULT '' NOT NULL,
|
---|
67 | "available" character(1) DEFAULT 'y' NOT NULL,
|
---|
68 | "notes" text DEFAULT '' NOT NULL,
|
---|
69 | "description" character varying(64) DEFAULT '' NOT NULL,
|
---|
70 | "circuitid" character varying(128) DEFAULT '' NOT NULL,
|
---|
71 | "privdata" text DEFAULT '' NOT NULL,
|
---|
72 | "newcustid" integer,
|
---|
73 | CHECK (((available = 'y'::bpchar) OR (available = 'n'::bpchar)))
|
---|
74 | );
|
---|
75 |
|
---|
76 | REVOKE ALL on "poolips" from PUBLIC;
|
---|
77 | GRANT ALL on "poolips" to "kdeugau";
|
---|
78 | GRANT ALL on "poolips" to "ipdb";
|
---|
79 |
|
---|
80 | CREATE TABLE "allocations" (
|
---|
81 | "cidr" cidr DEFAULT '255.255.255.255/32' NOT NULL PRIMARY KEY,
|
---|
82 | "custid" character varying(16) DEFAULT '',
|
---|
83 | "type" character(2) DEFAULT '',
|
---|
84 | "city" character varying(30) DEFAULT '',
|
---|
85 | "description" character varying(64) DEFAULT '',
|
---|
86 | "notes" text DEFAULT '',
|
---|
87 | "maskbits" integer DEFAULT 128,
|
---|
88 | "circuitid" character varying(128) DEFAULT '',
|
---|
89 | "privdata" text DEFAULT '' NOT NULL,
|
---|
90 | "newcustid" integer
|
---|
91 | );
|
---|
92 |
|
---|
93 | REVOKE ALL on "allocations" from PUBLIC;
|
---|
94 | GRANT ALL on "allocations" to "kdeugau";
|
---|
95 | GRANT ALL on "allocations" to "ipdb";
|
---|
96 |
|
---|
97 | CREATE VIEW "searchme" as SELECT allocations.cidr, allocations.custid, allocations."type", allocations.city, allocations.description, allocations.notes FROM allocations UNION SELECT poolips.ip, poolips.custid, poolips.type, poolips.city, poolips.description, poolips.notes FROM poolips;
|
---|
98 |
|
---|
99 | REVOKE ALL on "searchme" from PUBLIC;
|
---|
100 | GRANT ALL on "searchme" to "kdeugau";
|
---|
101 | GRANT ALL on "searchme" to "ipdb";
|
---|
102 |
|
---|
103 | CREATE TABLE "alloctypes" (
|
---|
104 | "type" character(2) DEFAULT '' NOT NULL PRIMARY KEY,
|
---|
105 | "listname" character varying(40) DEFAULT '',
|
---|
106 | "dispname" character varying(40) DEFAULT '',
|
---|
107 | "listorder" integer DEFAULT 0,
|
---|
108 | "def_custid" character varying(16) DEFAULT ''
|
---|
109 | );
|
---|
110 |
|
---|
111 | REVOKE ALL on "alloctypes" from PUBLIC;
|
---|
112 | GRANT ALL on "alloctypes" to "kdeugau";
|
---|
113 | GRANT ALL on "alloctypes" to "ipdb";
|
---|
114 |
|
---|
115 | CREATE TABLE "cities" (
|
---|
116 | "city" character varying(30) DEFAULT '' NOT NULL PRIMARY KEY,
|
---|
117 | "routing" character(1) DEFAULT 'n' NOT NULL
|
---|
118 | );
|
---|
119 |
|
---|
120 | REVOKE ALL on "cities" from PUBLIC;
|
---|
121 | GRANT ALL on "cities" to "kdeugau";
|
---|
122 | GRANT ALL on "cities" to "ipdb";
|
---|
123 |
|
---|
124 | --
|
---|
125 | -- Selected TOC Entries:
|
---|
126 | --
|
---|
127 | \connect - ipdb
|
---|
128 |
|
---|
129 | --
|
---|
130 | -- TOC Entry ID 2 (OID 92809)
|
---|
131 | --
|
---|
132 | -- Name: alloctypes Type: TABLE Owner: ipdb
|
---|
133 | --
|
---|
134 |
|
---|
135 | CREATE TABLE "alloctypes" (
|
---|
136 | "type" character(2) DEFAULT '' NOT NULL,
|
---|
137 | "listname" character varying(40) DEFAULT '',
|
---|
138 | "dispname" character varying(40) DEFAULT '',
|
---|
139 | "listorder" integer DEFAULT 0,
|
---|
140 | "def_custid" character varying(16) DEFAULT '',
|
---|
141 | Constraint "alloctypes_pkey" Primary Key ("type")
|
---|
142 | );
|
---|
143 |
|
---|
144 | --
|
---|
145 | -- TOC Entry ID 3 (OID 92809)
|
---|
146 | --
|
---|
147 | -- Name: alloctypes Type: ACL Owner:
|
---|
148 | --
|
---|
149 |
|
---|
150 | REVOKE ALL on "alloctypes" from PUBLIC;
|
---|
151 | GRANT ALL on "alloctypes" to "kdeugau";
|
---|
152 | GRANT ALL on "alloctypes" to "ipdb";
|
---|
153 |
|
---|
154 | --
|
---|
155 | -- Data for TOC Entry ID 4 (OID 92809)
|
---|
156 | --
|
---|
157 | -- Name: alloctypes Type: TABLE DATA Owner: ipdb
|
---|
158 | --
|
---|
159 |
|
---|
160 |
|
---|
161 | COPY "alloctypes" FROM stdin;
|
---|
162 | cd Static Pool - Cable Cable pool 41 CBL-BUS
|
---|
163 | dp Static Pool - DSL DSL pool 42 DSL-BUS
|
---|
164 | mp Static Pool - Dialup Static dialup pool 43 DIAL-BUS
|
---|
165 | wp Static Pool - Wireless Static wireless pool 44 WL-BUS
|
---|
166 | mm Master block Master block 999 6750400
|
---|
167 | in Internal netblock Internal netblock 990 6750400
|
---|
168 | sd Static Pool - Servers Server pool 40 6750400
|
---|
169 | cn Customer netblock Customer netblock 0
|
---|
170 | ci Static IP - Cable Static cable IP 21
|
---|
171 | di Static IP - DSL Static DSL IP 22
|
---|
172 | mi Static IP - Dialup Static dialup IP 23
|
---|
173 | wi Static IP - Wireless Static wireless IP 24
|
---|
174 | si Static IP - Server pool Server pool IP 20 6750400
|
---|
175 | wc Reserve for WAN blocks WAN IP blocks 200 6750400
|
---|
176 | wr Internal WAN block Internal WAN block 201 6750400
|
---|
177 | pc Reserve for dynamic-route DSL netblocks Dynamic-route netblocks 202 6750400
|
---|
178 | en End-use netblock End-use netblock 100 6750400
|
---|
179 | me Dialup netblock Dialup netblock 101 DIAL-RES
|
---|
180 | de Dynamic DSL block Dynamic DSL block 102 DSL-RES
|
---|
181 | ce Dynamic cable block Dynamic cable block 103 CBL-RES
|
---|
182 | we Dynamic WiFi block Dynamic WiFi block 104 WL-RES
|
---|
183 | rm Routing Routed netblock 500 6750400
|
---|
184 | pr Dynamic-route DSL netblock Dynamic-route DSL 203
|
---|
185 | li Static IP - LAN/POP Static LAN/POP IP 190 6750400
|
---|
186 | ld Static Pool - LAN/POP LAN pool 191 6750400
|
---|
187 | \.
|
---|
188 |
|
---|
189 |
|
---|
190 | --
|
---|
191 | -- User data table - required for proper ACLs
|
---|
192 | --
|
---|
193 |
|
---|
194 | CREATE TABLE "users" (
|
---|
195 | "username" varchar(16) NOT NULL PRIMARY KEY,
|
---|
196 | "password" varchar(16) DEFAULT '',
|
---|
197 | "acl" varchar(16) DEFAULT 'b'
|
---|
198 | );
|
---|