ALTER TABLE `glpi_plugin_eventlog_config` RENAME `glpi_plugin_eventlog_eventlogservers`;
ALTER TABLE `glpi_plugin_eventlog_ticket` RENAME `glpi_plugin_eventlog_ticketcategories`;
ALTER TABLE `glpi_plugin_eventlog_default` RENAME `glpi_plugin_eventlog_defaulttypes`;
DROP TABLE IF EXISTS `glpi_plugin_eventlog_display`;

ALTER TABLE `glpi_plugin_eventlog_eventlogservers` 
   CHANGE `ID` `id` int(11) NOT NULL auto_increment,
   ADD `name` varchar(255) collate utf8_unicode_ci default NULL,
   CHANGE `FK_entities` `entities_id` int(11) NOT NULL default '0',
   CHANGE `eventlog_db_user` `eventlog_db_user` varchar(255) collate utf8_unicode_ci default NULL,
   CHANGE `eventlog_db_passwd` `eventlog_db_passwd` varchar(255) collate utf8_unicode_ci default NULL,
   CHANGE `eventlog_db_host` `eventlog_db_host` varchar(255) collate utf8_unicode_ci default NULL,
   CHANGE `eventlog_db_name` `eventlog_db_name` varchar(255) collate utf8_unicode_ci default NULL;

ALTER TABLE `glpi_plugin_eventlog_ticketcategories` 
   CHANGE `ID` `id` int(11) NOT NULL auto_increment,
   CHANGE `category` `ticketcategories_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_ticketcategories (id)';

ALTER TABLE `glpi_plugin_eventlog_defaulttypes` 
   CHANGE `ID` `id` int(11) NOT NULL auto_increment,
   CHANGE `type` `types_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_dropdown_plugin_eventlog_type  from eventlog DB (id)';

ALTER TABLE `glpi_plugin_eventlog_profiles` 
   CHANGE `ID` `id` int(11) NOT NULL auto_increment,
   ADD `profiles_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_profiles (id)',
   CHANGE `eventlog` `eventlog` char(1) collate utf8_unicode_ci default NULL,
   ADD INDEX (`profiles_id`);

DROP TABLE IF EXISTS `glpi_plugin_eventlog_knowbaseitemcategories`;
CREATE TABLE `glpi_plugin_eventlog_knowbaseitemcategories` (
	`id` int(11) NOT NULL auto_increment,
	`knowbaseitemcategories_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_knowbaseitemcategories (id)',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

DROP TABLE IF EXISTS `glpi_plugin_eventlog_defaultlogs`;
CREATE TABLE `glpi_plugin_eventlog_defaultlogs` (
	`id` int(11) NOT NULL auto_increment,
	`logs_name` varchar(255) collate utf8_unicode_ci default NULL COMMENT 'RELATION to events from eventlog DB (log)',
	PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

INSERT INTO glpi_displaypreferences VALUES (NULL,'PluginEventlogEventlog','1','1','0');
INSERT INTO glpi_displaypreferences VALUES (NULL,'PluginEventlogEventlog','4','2','0');
INSERT INTO glpi_displaypreferences VALUES (NULL,'PluginEventlogEventlog','3','3','0');
INSERT INTO glpi_displaypreferences VALUES (NULL,'PluginEventlogEventlog','6','4','0');
INSERT INTO glpi_displaypreferences VALUES (NULL,'PluginEventlogEventlog','7','5','0');
INSERT INTO glpi_displaypreferences VALUES (NULL,'PluginEventlogEventlog','5','6','0');
INSERT INTO glpi_displaypreferences VALUES (NULL,'PluginEventlogEventlog','8','7','0');
INSERT INTO glpi_displaypreferences VALUES (NULL,'PluginEventlogEventlog','10','8','0');