CREATE TABLE asset (
  asset_id int(10) NOT NULL auto_increment,
  asset_name varchar(100) NOT NULL,
  asset_hostname varchar(100) NOT NULL,
  assetclass_id int(10) NOT NULL,
  asset_info text NOT NULL,
  PRIMARY KEY  (asset_id)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;

INSERT INTO asset (asset_name, assetclass_id) VALUES
('My Computer', 1),
('My Server', 2);


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

INSERT INTO assetclass (assetclassgroup_id, assetclass_name) VALUES
(1, 'PC'),
(2, 'Server');


CREATE TABLE assetclassgroup (
  assetclassgroup_id int(10) NOT NULL auto_increment,
  assetclassgroup_name varchar(100) NOT NULL,
  assetclassgroup_color varchar(6) NOT NULL,
  PRIMARY KEY  (assetclassgroup_id)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;

INSERT INTO assetclassgroup (assetclassgroup_name, assetclassgroup_color) VALUES
('Workstations', 000000);


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

INSERT INTO location (location_name, location_parent) VALUES
('Main Office', 0);


CREATE TABLE nat (
  nat_id int(10) NOT NULL auto_increment,
  nat_type int(1) NOT NULL,
  nat_ext int(10) NOT NULL,
  nat_int int(10) NOT NULL,
  PRIMARY KEY  (nat_id)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;


CREATE TABLE node (
  node_id int(10) NOT NULL auto_increment,
  node_ip varchar(15) NOT NULL,
  node_mac varchar(12) NOT NULL,
  node_dns1 varchar(100) NOT NULL,
  node_dns2 varchar(100) NOT NULL,
  subnet_id int(10) NOT NULL,
  asset_id int(10) NOT NULL,
  node_info text NOT NULL,
  PRIMARY KEY  (node_id)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;

INSERT INTO node (node_ip, node_mac, subnet_id, asset_id) VALUES
('192.168.1.2', '001122334455', 1, 1),
('192.168.1.1', 'aabbccddeeff', 1, 2);


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


INSERT INTO subnet (subnet_address, subnet_mask) VALUES
('192.168.0.0', 24);


CREATE TABLE subnetlocation (
  subnetlocation_id int(10) NOT NULL auto_increment,
  subnet_id int(10) NOT NULL,
  location_id int(10) NOT NULL,
  PRIMARY KEY  (subnetlocation_id)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;

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


CREATE TABLE subnetvlan (
  subnetvlan_id int(10) NOT NULL auto_increment,
  subnet_id int(10) NOT NULL,
  vlan_id int(10) NOT NULL,
  PRIMARY KEY  (subnetvlan_id)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;


CREATE TABLE user (
  user_id int(10) NOT NULL auto_increment,
  user_name varchar(100) NOT NULL,
  user_pass varchar(32) NOT NULL,
  user_displayname varchar(100) NOT NULL,
  user_imagesize int(3) NOT NULL default 6,
  user_imagecount int(3) NOT NULL default 64,
  user_mac varchar(25) NOT NULL default 'xxxxxxxxxxxx',
  user_dateformat varchar(10) NOT NULL default 'd M Y H:i',
  user_dns1suffix varchar(100) NOT NULL,
  user_dns2suffix varchar(100) NOT NULL,
  user_menu_assets varchar(2) NOT NULL default 'on',
  user_menu_assetclasses varchar(2) NOT NULL default 'on',
  user_menu_assetclassgroups varchar(2) NOT NULL default 'on',
  user_menu_locations varchar(2) NOT NULL default 'on',
  user_menu_nodes varchar(2) NOT NULL default 'on',
  user_menu_subnets varchar(2) NOT NULL default 'on',
  user_menu_users varchar(2) NOT NULL default 'on',
  user_menu_vlans varchar(2) NOT NULL default 'on',
  PRIMARY KEY  (user_id)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;

INSERT INTO user (user_name, user_pass, user_displayname, user_imagesize, user_imagecount, user_mac, user_dateformat, user_menu_assets, user_menu_assetclasses, user_menu_assetclassgroups, user_menu_locations, user_menu_nodes, user_menu_subnets, user_menu_users, user_menu_vlans) VALUES
('admin', '21232f297a57a5a743894a0e4a801fc3', 'administrator', 6, 64, 'xxxxxxxxxxxx', 'd M Y H:i', 'on', 'on', 'on', 'on', 'on', 'on', 'on', 'on');


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

INSERT INTO vlan (vlan_number, vlan_name) VALUES
(1, 'DEFAULT_VLAN');