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