 create index node_id_type_idx on node(nodeID, nodeType);
 create index node_label_idx on node(nodeLabel);
 
---########################################################################
---# ipInterface Table - Contains information on interfaces which support
---#                     TCP/IP as well as current status information.
---#                     ipAddr is integer, to support easier filtering.
---#
---# This table contains the following information:
---#
---#  nodeID          : Unique identifier of the node that "owns" this interface
---#  ipAddr          : IP Address associated with this interface
---#  ifIndex	     : SNMP index of interface, used to uniquely identify
---# 		       unnumbered interfaces.
---#
---# NOTE: The combination of nodeID, ipAddr, and ifIndex must be unique,
---# and this must be enforced programmatically.
---#
---#  ipHostname      : IP Hostname associated with this interface
---#  isManaged       : Character used as a boolean flag
---#                     'M' - Managed
---#                     'A' - Alias
---#                     'D' - Deleted
---#                     'U' - Unmanaged
---#			'F' - Forced Unmanaged (via the user interface)
---#                     'N' - Not polled as part of any package
---#  ipStatus        : If interface supports SNMP this field will
---#                    hold a numeric representation of interface's
---#                    operational status (same as 'snmpIfOperStatus'
---#                    field in the snmpInterface table).
---#                      1 = Up, 2 = Down, 3 = Testing
---#  ipLastCapsdPoll : Date and time of last poll by capsd
---#  isSnmpPrimary   : Character used as a boolean flag
---#                      'P' - Primary SNMP
---#                      'S' - Secondary SNMP
---#                      'N' - Not eligible (does not support SNMP or
---#                               or has no ifIndex)
---#
---########################################################################
-
-create table ipInterface (
-    id              integer,
-	nodeID			integer,
-	ipAddr			varchar(16) not null,
-	ifIndex			integer,
-	ipHostname		varchar(256),
-	isManaged		char(1),
-	ipStatus		integer,
-	ipLastCapsdPoll		timestamp without time zone,
-	isSnmpPrimary           char(1),
-
-    constraint pk_ipInterface_id primary key (id),
-	constraint fk_nodeID1 foreign key (nodeID) references node ON DELETE CASCADE
-);
-
-create index ipinterface_nodeid_ipaddr_ismanaged_idx on ipInterface(nodeID, ipAddr, isManaged);
-create index ipinterface_ipaddr_ismanaged_idx on ipInterface(ipAddr, isManaged);
-create index ipinterface_ipaddr_idx on ipInterface(ipAddr);
-create index ipinterface_nodeid_ismanaged_idx on ipInterface(ipAddr);
-create index ipinterface_nodeid_idx on ipInterface(nodeID);
-
 --#########################################################################
 --# snmpInterface Table - Augments the ipInterface table with information
 --#                       available from IP interfaces which also support

drop table qrtz_calendars;

--# End quartz persistence

--########################################################################
--# serverMap table - Contains a list of IP Addresses mapped to

drop sequence pollResultNxtId;
drop sequence vulnNxtId;
drop sequence reportNxtId;
drop sequence mapNxtId;
drop sequence opennmsNxtId;  --# should be used for all sequences, eventually

--# Begin quartz persistence 
