CREATE TABLE IF NOT EXISTS `cmpMemPool` (  `cmp_id` int(11) NOT NULL auto_increment,  `Index` varchar(8) NOT NULL,  `cmpName` varchar(32) NOT NULL,  `cmpValid` varchar(8) NOT NULL,  `device_id` int(11) NOT NULL,  `cmpUsed` int(11) NOT NULL,  `cmpFree` int(11) NOT NULL,  `cmpLargestFree` int(11) NOT NULL,  `cmpAlternate` tinyint(4) default NULL,  PRIMARY KEY  (`cmp_id`),  KEY `device_id` (`device_id`)) ENGINE=MyISAM  DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `hrDevice` ( `hrDevice_id` int(11) NOT NULL auto_increment,  `device_id` int(11) NOT NULL,  `hrDeviceIndex` int(11) NOT NULL,  `hrDeviceDescr` text NOT NULL,  `hrDeviceType` text NOT NULL,  `hrDeviceErrors` int(11) NOT NULL,  `hrDeviceStatus` text NOT NULL,  `hrProcessorLoad` tinyint(4) default NULL,  PRIMARY KEY  (`hrDevice_id`),  KEY `device_id` (`device_id`)) ENGINE=MyISAM  DEFAULT CHARSET=latin1;
ALTER TABLE `entPhysical` MODIFY COLUMN  `entPhysicalHardwareRev` VARCHAR( 16 ) NULL AFTER  `entPhysicalName` ,MODIFY COLUMN  `entPhysicalFirmwareRev` VARCHAR( 16 ) NULL AFTER  `entPhysicalHardwareRev` ,MODIFY COLUMN  `entPhysicalSoftwareRev` VARCHAR( 16 ) NULL AFTER  `entPhysicalFirmwareRev` ,MODIFY COLUMN  `entPhysicalAlias` VARCHAR( 32 ) NULL AFTER  `entPhysicalSoftwareRev` ,MODIFY COLUMN  `entPhysicalAssetID` VARCHAR( 32 ) NULL AFTER  `entPhysicalAlias` ,MODIFY COLUMN  `entPhysicalIsFRU` VARCHAR( 8 ) NULL AFTER  `entPhysicalAssetID`;
ALTER TABLE `devices` MODIFY COLUMN `last_discovered` timestamp NULL DEFAULT NULL AFTER `last_polled`;
ALTER TABLE `storage` MODIFY COLUMN `storage_type` VARCHAR( 32 ) NULL DEFAULT NULL AFTER `storage_index`;
ALTER TABLE `devices` MODIFY `type` varchar(8) DEFAULT 'unknown';
ALTER TABLE `devices` CHANGE `os` `os` VARCHAR( 32 ) NULL DEFAULT NULL;
CREATE TABLE IF NOT EXISTS `dbSchema` ( `revision` int(11) NOT NULL default '0', PRIMARY KEY (`revision`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `voltage` (  `volt_id` int(11) NOT NULL auto_increment,  `volt_host` int(11) NOT NULL default '0',  `volt_oid` varchar(64) NOT NULL,  `volt_descr` varchar(32) NOT NULL default '',  `volt_precision` int(11) NOT NULL default '1',  `volt_current` int(11) NOT NULL default '0',  `volt_limit` int(11) NOT NULL default '60',  PRIMARY KEY  (`volt_id`),  KEY `volt_host` (`volt_host`)) ENGINE=InnoDB  DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `fanspeed` (   `fan_id` int(11) NOT NULL auto_increment,  `fan_host` int(11) NOT NULL default '0',  `fan_oid` varchar(64) NOT NULL,  `fan_descr` varchar(32) NOT NULL default '',  `fan_precision` int(11) NOT NULL default '1',  `fan_current` int(11) NOT NULL default '0',  `fan_limit` int(11) NOT NULL default '60',  PRIMARY KEY  (`fan_id`),  KEY `fan_host` (`fan_host`)) ENGINE=InnoDB  DEFAULT CHARSET=latin1;
ALTER TABLE `voltage` ADD `volt_limit_low` int(11) NULL DEFAULT NULL AFTER `volt_limit`;
ALTER TABLE `voltage` CHANGE `volt_current` `volt_current` FLOAT(3) NULL DEFAULT NULL;
ALTER TABLE `voltage` CHANGE `volt_limit` `volt_limit` FLOAT(3) NULL DEFAULT NULL;
ALTER TABLE `voltage` CHANGE `volt_limit_low` `volt_limit_low` FLOAT(3) NULL DEFAULT NULL;
ALTER TABLE  `fanspeed` ADD  `fan_index` INT NOT NULL AFTER  `fan_host` , ADD  `fan_mibtype` VARCHAR( 32 ) NOT NULL AFTER  `fan_index`;
ALTER TABLE  `fanspeed` CHANGE  `fan_host`  `device_id` INT( 11 ) NOT NULL DEFAULT  '0';
ALTER TABLE  `voltage` CHANGE  `volt_host`  `device_id` INT( 11 ) NOT NULL DEFAULT  '0';
CREATE TABLE IF NOT EXISTS `processors` (  `processor_id` int(11) NOT NULL AUTO_INCREMENT,  `entPhysicalIndex` int(11) NOT NULL,  `device_id` int(11) NOT NULL,  `processor_oid` int(11) NOT NULL,  `processor_type` int(11) NOT NULL,  `processor_usage` int(11) NOT NULL,  `processor_description` varchar(64) NOT NULL,  PRIMARY KEY (`processor_id`),  KEY `cpuCPU_id` (`processor_id`,`device_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
ALTER TABLE  `processors` MODIFY COLUMN `hrDeviceIndex` int(11) NULL AFTER `entPhysicalIndex`;
ALTER TABLE  `processors` MODIFY COLUMN `processor_index` varchar(32) NOT NULL AFTER `processor_oid`;
ALTER TABLE  `processors` CHANGE `processor_descr` `processor_descr` varchar(64) NOT NULL;
ALTER TABLE  `fanspeed` CHANGE `fan_mibtype` `fan_type` varchar(64) NOT NULL ;
ALTER TABLE  `voltage` ADD  `volt_index` VARCHAR( 8 ) NOT NULL AFTER  `volt_oid`,ADD  `volt_type` VARCHAR( 32 ) NOT NULL AFTER  `volt_index` ;
ALTER TABLE `processors` CHANGE `processor_type` `processor_type` varchar(16) NOT NULL;
ALTER TABLE `bgpPeers_cbgp` CHANGE `afi` `afi` VARCHAR( 16 ) NOT NULL , CHANGE `safi` `safi` VARCHAR( 16 ) NOT NULL;
ALTER TABLE  `eventlog` MODIFY COLUMN  `reference` VARCHAR( 64 ) NOT NULL AFTER  `type`;
ALTER TABLE  `processors` CHANGE  `processor_oid`  `processor_oid` VARCHAR( 128 ) NOT NULL;
ALTER TABLE eventlog CHANGE `type` `type` VARCHAR( 64 ) NOT NULL;
CREATE TABLE IF NOT EXISTS `mempools` (  `mempool_id` int(11) NOT NULL AUTO_INCREMENT,  `mempool_index` varchar(8) CHARACTER SET latin1 NOT NULL,  `entPhysicalIndex` int(11) DEFAULT NULL,  `hrDeviceIndex` int(11) DEFAULT NULL,  `mempool_type` varchar(32) CHARACTER SET latin1 NOT NULL,  `mempool_precision` int(11) NOT NULL DEFAULT '1',  `mempool_descr` varchar(32) CHARACTER SET latin1 NOT NULL,  `device_id` int(11) NOT NULL,  `mempool_used` int(11) NOT NULL,  `mempool_free` int(11) NOT NULL,  `mempool_total` int(11) NOT NULL,  `mempool_largestfree` int(11) DEFAULT NULL,  `mempool_lowestfree` int(11) DEFAULT NULL,  PRIMARY KEY (`mempool_id`),  KEY `device_id` (`device_id`)) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin ;
ALTER TABLE `storage` CHANGE `storage_size` `storage_size` BIGINT NOT NULL ,CHANGE `storage_used` `storage_used` BIGINT NOT NULL ,CHANGE `storage_free` `storage_free` BIGINT NOT NULL;
ALTER TABLE `mempools` CHANGE `mempool_used` `mempool_used` BIGINT( 20 ) NOT NULL , CHANGE `mempool_free` `mempool_free` BIGINT( 20 ) NOT NULL ,CHANGE `mempool_total` `mempool_total` BIGINT( 20 ) NOT NULL ,CHANGE `mempool_largestfree` `mempool_largestfree` BIGINT( 20 ) NULL DEFAULT NULL ,CHANGE `mempool_lowestfree` `mempool_lowestfree` BIGINT( 20 ) NULL DEFAULT NULL;
ALTER TABLE `juniAtmVp` MODIFY COLUMN `juniAtmVp_id` int(11) NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (`juniAtmVp_id`);

