 --
 CREATE TABLE ip_net_schema (
 	id serial PRIMARY KEY,
-	name text UNIQUE,
+	name text NOT NULL,
 	description text,
-	vrf text UNIQUE
+	vrf text
 );
 
+CREATE UNIQUE INDEX ip_net_schema__name__index ON ip_net_schema (name);
+CREATE UNIQUE INDEX ip_net_schema__vrf__index ON ip_net_schema (vrf);
+
 COMMENT ON TABLE ip_net_schema IS 'IP Address schemas, something like namespaces for our address plan';
+COMMENT ON INDEX ip_net_schema__name__index IS 'Schema name';
+COMMENT ON INDEX ip_net_schema__vrf__index IS 'Schema VRF-id';
 
 
 --

CREATE UNIQUE INDEX ip_net_pool__schema_name__index ON ip_net_pool (schema, name);

COMMENT ON TABLE ip_net_pool IS 'IP Pools for assigning prefixes from';


--

--
CREATE TABLE ip_net_pool (
	id serial PRIMARY KEY,
	name text NOT NULL,
	schema integer NOT NULL REFERENCES ip_net_schema (id) ON UPDATE CASCADE ON DELETE CASCADE DEFAULT 1,
	description text,
	default_type ip_net_plan_type,
	ipv4_default_prefix_length integer,
