Index: /branches/stable/cgi-bin/ipdb.psql
===================================================================
--- /branches/stable/cgi-bin/ipdb.psql	(revision 176)
+++ /branches/stable/cgi-bin/ipdb.psql	(revision 177)
@@ -1,30 +1,5 @@
---
--- Selected TOC Entries:
---
 \connect - postgres
 
---
--- TOC Entry ID 22 (OID 16556)
---
--- Name: "plpgsql_call_handler" () Type: FUNCTION Owner: postgres
---
-
-CREATE FUNCTION "plpgsql_call_handler" () RETURNS opaque AS '$libdir/plpgsql', 'plpgsql_call_handler' LANGUAGE 'C';
-
---
--- TOC Entry ID 23 (OID 16557)
---
--- Name: plpgsql Type: PROCEDURAL LANGUAGE Owner: 
---
-
-CREATE TRUSTED PROCEDURAL LANGUAGE 'plpgsql' HANDLER "plpgsql_call_handler" LANCOMPILER '';
-
-\connect - ipdb
-
---
--- TOC Entry ID 2 (OID 25854)
---
--- Name: customers Type: TABLE Owner: ipdb
---
+\connect ipdb ipdb
 
 CREATE TABLE "customers" (
@@ -43,30 +18,11 @@
 );
 
---
--- TOC Entry ID 3 (OID 25854)
---
--- Name: customers Type: ACL Owner: 
---
-
 REVOKE ALL on "customers" from PUBLIC;
 GRANT ALL on "customers" to "kdeugau";
 GRANT ALL on "customers" to "ipdb";
 
---
--- TOC Entry ID 4 (OID 25872)
---
--- Name: masterblocks Type: TABLE Owner: ipdb
---
-
 CREATE TABLE "masterblocks" (
-	"cidr" cidr DEFAULT '255.255.255.255/32' NOT NULL,
-	Constraint "masterblocks_pkey" Primary Key ("cidr")
+	"cidr" cidr DEFAULT '255.255.255.255/32' NOT NULL PRIMARY KEY
 );
-
---
--- TOC Entry ID 5 (OID 25872)
---
--- Name: masterblocks Type: ACL Owner: 
---
 
 REVOKE ALL on "masterblocks" from PUBLIC;
@@ -74,22 +30,9 @@
 GRANT ALL on "masterblocks" to "ipdb";
 
---
--- TOC Entry ID 6 (OID 25875)
---
--- Name: routed Type: TABLE Owner: ipdb
---
-
 CREATE TABLE "routed" (
-	"cidr" cidr DEFAULT '255.255.255.255/32' NOT NULL,
+	"cidr" cidr DEFAULT '255.255.255.255/32' NOT NULL PRIMARY KEY,
 	"maskbits" integer DEFAULT 128,
-	"city" character varying(30) DEFAULT '',
-	Constraint "routed_pkey" Primary Key ("cidr")
+	"city" character varying(30) DEFAULT ''
 );
-
---
--- TOC Entry ID 7 (OID 25875)
---
--- Name: routed Type: ACL Owner: 
---
 
 REVOKE ALL on "routed" from PUBLIC;
@@ -97,19 +40,7 @@
 GRANT ALL on "routed" to "ipdb";
 
---
--- TOC Entry ID 8 (OID 31131)
---
--- Name: temp Type: TABLE Owner: ipdb
---
-
 CREATE TABLE "temp" (
 	"ofs" integer
 );
-
---
--- TOC Entry ID 9 (OID 31131)
---
--- Name: temp Type: ACL Owner: 
---
 
 REVOKE ALL on "temp" from PUBLIC;
@@ -117,41 +48,10 @@
 GRANT ALL on "temp" to "ipdb";
 
---
--- TOC Entry ID 10 (OID 73917)
---
--- Name: searchme Type: VIEW Owner: ipdb
---
-
-CREATE VIEW "searchme" as SELECT allocations.cidr, allocations.custid, allocations."type", allocations.city, allocations.description FROM allocations UNION SELECT poolips.ip, poolips.custid, poolips.ptype, poolips.city, poolips.description FROM poolips;
-
---
--- TOC Entry ID 11 (OID 73917)
---
--- Name: searchme Type: ACL Owner: 
---
-
-REVOKE ALL on "searchme" from PUBLIC;
-GRANT ALL on "searchme" to "kdeugau";
-GRANT ALL on "searchme" to "ipdb";
-
---
--- TOC Entry ID 12 (OID 91065)
---
--- Name: freeblocks Type: TABLE Owner: ipdb
---
-
 CREATE TABLE "freeblocks" (
-	"cidr" cidr DEFAULT '255.255.255.255/32' NOT NULL,
+	"cidr" cidr DEFAULT '255.255.255.255/32' NOT NULL PRIMARY KEY
 	"maskbits" integer DEFAULT 128,
 	"city" character varying(30) DEFAULT '',
-	"routed" character(1) DEFAULT 'n',
-	Constraint "freeblocks_pkey" Primary Key ("cidr")
+	"routed" character(1) DEFAULT 'n'
 );
-
---
--- TOC Entry ID 13 (OID 91065)
---
--- Name: freeblocks Type: ACL Owner: 
---
 
 REVOKE ALL on "freeblocks" from PUBLIC;
@@ -159,29 +59,17 @@
 GRANT ALL on "freeblocks" to "ipdb";
 
---
--- TOC Entry ID 14 (OID 92444)
---
--- Name: poolips Type: TABLE Owner: ipdb
---
-
 CREATE TABLE "poolips" (
 	"pool" cidr DEFAULT '255.255.255.255/32' NOT NULL,
-	"ip" cidr DEFAULT '255.255.255.255/32' NOT NULL,
+	"ip" cidr DEFAULT '255.255.255.255/32' NOT NULL PRIMARY KEY,
 	"custid" character varying(16) DEFAULT '' NOT NULL,
-	"city" character varying(30) DEFAULT '',
-	"ptype" character(1) DEFAULT 'c' NOT NULL,
-	"available" character(1) DEFAULT 'y',
-	"notes" text DEFAULT '',
-	"description" character varying(64) DEFAULT '',
-	"circuitid" character varying(128) DEFAULT '',
-	CHECK (((available = 'y'::bpchar) OR (available = 'n'::bpchar))),
-	Constraint "poolips_pkey" Primary Key ("ip")
+	"city" character varying(30) DEFAULT '' NOT NULL,
+	"type" character(2) DEFAULT '' NOT NULL,
+	"available" character(1) DEFAULT 'y' NOT NULL,
+	"notes" text DEFAULT '' NOT NULL,
+	"description" character varying(64) DEFAULT '' NOT NULL,
+	"circuitid" character varying(128) DEFAULT '' NOT NULL,
+	"newcustid" integer,
+	CHECK (((available = 'y'::bpchar) OR (available = 'n'::bpchar)))
 );
-
---
--- TOC Entry ID 15 (OID 92444)
---
--- Name: poolips Type: ACL Owner: 
---
 
 REVOKE ALL on "poolips" from PUBLIC;
@@ -189,12 +77,6 @@
 GRANT ALL on "poolips" to "ipdb";
 
---
--- TOC Entry ID 16 (OID 92725)
---
--- Name: allocations Type: TABLE Owner: ipdb
---
-
 CREATE TABLE "allocations" (
-	"cidr" cidr DEFAULT '255.255.255.255/32' NOT NULL,
+	"cidr" cidr DEFAULT '255.255.255.255/32' NOT NULL PRIMARY KEY,
 	"custid" character varying(16) DEFAULT '',
 	"type" character(2) DEFAULT '',
@@ -204,12 +86,6 @@
 	"maskbits" integer DEFAULT 128,
 	"circuitid" character varying(128) DEFAULT '',
-	Constraint "allocations_pkey" Primary Key ("cidr")
+	"newcustid" integer
 );
-
---
--- TOC Entry ID 17 (OID 92725)
---
--- Name: allocations Type: ACL Owner: 
---
 
 REVOKE ALL on "allocations" from PUBLIC;
@@ -217,23 +93,17 @@
 GRANT ALL on "allocations" to "ipdb";
 
---
--- TOC Entry ID 18 (OID 92809)
---
--- Name: alloctypes Type: TABLE Owner: ipdb
---
+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;
+
+REVOKE ALL on "searchme" from PUBLIC;
+GRANT ALL on "searchme" to "kdeugau";
+GRANT ALL on "searchme" to "ipdb";
 
 CREATE TABLE "alloctypes" (
-	"type" character(2) DEFAULT '' NOT NULL,
+	"type" character(2) DEFAULT '' NOT NULL PRIMARY KEY,
 	"listname" character varying(40) DEFAULT '',
 	"dispname" character varying(40) DEFAULT '',
 	"listorder" integer DEFAULT 0,
-	Constraint "alloctypes_pkey" Primary Key ("type")
+	"def_custid" character varying(16) DEFAULT ''
 );
-
---
--- TOC Entry ID 19 (OID 92809)
---
--- Name: alloctypes Type: ACL Owner: 
---
 
 REVOKE ALL on "alloctypes" from PUBLIC;
@@ -241,21 +111,8 @@
 GRANT ALL on "alloctypes" to "ipdb";
 
---
--- TOC Entry ID 20 (OID 93964)
---
--- Name: cities Type: TABLE Owner: ipdb
---
-
 CREATE TABLE "cities" (
-	"city" character varying(30) DEFAULT '' NOT NULL,
+	"city" character varying(30) DEFAULT '' NOT NULL PRIMARY KEY,
 	"routing" character(1) DEFAULT 'n' NOT NULL,
-	Constraint "cities_pkey" Primary Key ("city")
 );
-
---
--- TOC Entry ID 21 (OID 93964)
---
--- Name: cities Type: ACL Owner: 
---
 
 REVOKE ALL on "cities" from PUBLIC;
