SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

CREATE TABLE `asset` (
  `asset_id` int(10) NOT NULL auto_increment,
  `asset_name` varchar(100) NOT NULL default '',
  `hostname` varchar(100) NOT NULL default '',
  `assetclass_id` int(10) NOT NULL default '0',
  `asset_info` text NOT NULL,
  PRIMARY KEY  (`asset_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;

INSERT INTO `asset` (`asset_id`, `asset_name`, `hostname`, `assetclass_id`, `asset_info`) VALUES
(1, 'TestPC', 'TestPC', 1, 'This is just a test PC');

CREATE TABLE `assetclass` (
  `assetclass_id` int(10) NOT NULL auto_increment,
  `assetclassgroup_id` int(10) NOT NULL default '0',
  `assetclass_name` varchar(100) NOT NULL default '',
  PRIMARY KEY  (`assetclass_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;

INSERT INTO `assetclass` (`assetclass_id`, `assetclassgroup_id`, `assetclass_name`) VALUES
(1, 1, 'PC'),
(2, 2, 'Switch');

CREATE TABLE `assetclassgroup` (
  `assetclassgroup_id` int(10) NOT NULL auto_increment,
  `assetclassgroup_name` varchar(100) NOT NULL default '',
  `color` varchar(6) NOT NULL,
  PRIMARY KEY  (`assetclassgroup_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;

INSERT INTO `assetclassgroup` (`assetclassgroup_id`, `assetclassgroup_name`, `color`) VALUES
(1, 'Workstations', '000000'),
(2, 'Network', 'FF0000');

CREATE TABLE `location` (
  `location_id` int(10) NOT NULL auto_increment,
  `location_name` varchar(100) NOT NULL default '',
  `parent` int(1) NOT NULL default '0',
  `location_info` text NOT NULL,
  PRIMARY KEY  (`location_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;

INSERT INTO `location` (`location_id`, `location_name`, `parent`, `location_info`) VALUES
(1, 'Main Office', 0, 'Our Main Office Building');

CREATE TABLE `node` (
  `node_id` int(10) NOT NULL auto_increment,
  `ip` varchar(15) NOT NULL default '',
  `mac` varchar(12) NOT NULL default '',
  `dns1` varchar(100) NOT NULL default '',
  `dns2` varchar(100) NOT NULL default '',
  `subnet_id` int(10) NOT NULL default '0',
  `asset_id` int(10) NOT NULL default '0',
  `node_info` text NOT NULL,
  PRIMARY KEY  (`node_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;

INSERT INTO `node` (`node_id`, `ip`, `mac`, `dns1`, `dns2`, `subnet_id`, `asset_id`, `node_info`) VALUES
(1, '192.168.0.1', '', '', '', 1, 1, '');

CREATE TABLE `subnet` (
  `subnet_id` int(10) NOT NULL auto_increment,
  `subnet_address` varchar(15) NOT NULL default '',
  `subnet_mask` int(2) NOT NULL default '0',
  `vlan_id` int(10) NOT NULL default '0',
  `subnet_info` text NOT NULL,
  PRIMARY KEY  (`subnet_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;

INSERT INTO `subnet` (`subnet_id`, `subnet_address`, `subnet_mask`, `vlan_id`, `subnet_info`) VALUES
(1, '192.168.0.1', 24, 1, '');

CREATE TABLE `subnetlocation` (
  `subnetlocation_id` int(10) NOT NULL auto_increment,
  `subnet_id` int(10) NOT NULL default '0',
  `location_id` int(10) NOT NULL default '0',
  PRIMARY KEY  (`subnetlocation_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;

INSERT INTO `subnetlocation` (`subnetlocation_id`, `subnet_id`, `location_id`) VALUES
(1, 1, 1);

CREATE TABLE `user` (
  `user_id` int(10) NOT NULL auto_increment,
  `user_name` varchar(100) NOT NULL default '',
  `user_pass` varchar(32) NOT NULL default '',
  `user_level` int(1) NOT NULL default '0',
  `user_displayname` varchar(100) NOT NULL default '',
  `user_mac` varchar(25) NOT NULL default 'xxxxxxxxxxxx',
  `user_lang` varchar(3) NOT NULL default '',
  PRIMARY KEY  (`user_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;

INSERT INTO `user` (`user_id`, `user_name`, `user_pass`, `user_level`, `user_displayname`, `user_mac`, `user_lang`) VALUES
(1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 2, 'admin', 'xxxxxxxxxxxx', 'en');

CREATE TABLE `userclass` (
  `userclass_id` int(10) NOT NULL auto_increment,
  `userclass_name` varchar(100) collate latin1_general_ci NOT NULL,
  PRIMARY KEY  (`userclass_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=2 ;

INSERT INTO `userclass` (`userclass_id`, `userclass_name`) VALUES
(1, 'IP Reg Administrators');

CREATE TABLE `userclassauth` (
  `userclassauth_id` int(10) NOT NULL auto_increment,
  `ordering` int(3) NOT NULL,
  `userclass_id` int(10) NOT NULL,
  `item` varchar(100) collate latin1_general_ci NOT NULL,
  `id` int(10) NOT NULL,
  `auth` int(1) NOT NULL,
  PRIMARY KEY  (`userclassauth_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=2 ;


INSERT INTO `userclassauth` (`userclassauth_id`, `ordering`, `userclass_id`, `item`, `id`, `auth`) VALUES
(1, 1, 1, 'ipreg', 0, 2);

CREATE TABLE `useruserclass` (
  `useruserclass_id` int(10) NOT NULL auto_increment,
  `user_id` int(10) NOT NULL,
  `userclass_id` int(10) NOT NULL,
  PRIMARY KEY  (`useruserclass_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=2 ;


INSERT INTO `useruserclass` (`useruserclass_id`, `user_id`, `userclass_id`) VALUES
(1, 1, 1);

CREATE TABLE `vlan` (
  `vlan_id` int(10) NOT NULL auto_increment,
  `vlan_number` int(3) NOT NULL default '0',
  `vlan_name` varchar(100) NOT NULL default '',
  `vlan_info` text NOT NULL,
  PRIMARY KEY  (`vlan_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;

INSERT INTO `vlan` (`vlan_id`, `vlan_number`, `vlan_name`, `vlan_info`) VALUES
(1, 1, 'VLAN', 'Default VLAN');