-- Database of NeonServ V4 modifications for NeonServ V5

ALTER TABLE `bots` CHANGE `botclass` `botclass` INT( 10 ) NOT NULL;

ALTER TABLE `users` CHANGE `user_lang` `user_lang` VARCHAR( 6 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL;
ALTER TABLE `users` ADD `user_reply_privmsg` TINYINT( 1 ) NOT NULL ;

CREATE TABLE IF NOT EXISTS `godlog` (
  `godlog_id` int(11) NOT NULL AUTO_INCREMENT,
  `godlog_uid` int(11) NOT NULL,
  `godlog_cid` int(15) NOT NULL,
  `godlog_time` int(15) NOT NULL,
  `godlog_cmd` varchar(512) NOT NULL,
  PRIMARY KEY (`godlog_id`)
) ENGINE=MyISAM;

ALTER TABLE `channels` ADD `channel_lastgiveowner` INT( 11 ) NOT NULL AFTER `channel_lastvisit`;

CREATE TABLE IF NOT EXISTS `owner_history` (
`owner_history_id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`owner_history_cid` INT( 11 ) NOT NULL ,
`owner_history_uid` INT( 11 ) NOT NULL ,
`owner_history_time` INT( 11 ) NOT NULL ,
INDEX ( `owner_history_cid` )
) ENGINE = MYISAM ;

ALTER TABLE `chanusers` ADD INDEX ( `chanuser_cid` ) ;
ALTER TABLE `chanusers` ADD INDEX ( `chanuser_uid` ) ;

ALTER TABLE `bot_binds` ADD `chan_access` VARCHAR( 256 ) NULL DEFAULT NULL AFTER `parameters`;

ALTER TABLE `bot_binds` CHANGE `global_access` `global_access` INT( 3 ) NULL;

ALTER TABLE `bans` CHANGE `ban_owner` `ban_owner` INT( 11 ) NOT NULL;

ALTER TABLE `channels` ADD `channel_exttopic` TINYINT( 1 ) NOT NULL AFTER `channel_topicmask` ,
ADD `channel_exttopic_topic` VARCHAR( 512 ) NOT NULL AFTER `channel_exttopic`;

ALTER TABLE `bots` ADD `max_channels` INT( 5 ) NOT NULL ;

ALTER TABLE `bot_binds` CHANGE `botid` `botclass` INT( 11 ) NOT NULL;
ALTER TABLE `bots` DROP `whoisbot` ;
ALTER TABLE `bots` DROP `bindFrom` ;
ALTER TABLE `bots` ADD `register_order` INT( 2 ) NOT NULL;

CREATE TABLE IF NOT EXISTS `help` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `lang` varchar(6) NOT NULL,
  `ident` varchar(64) NOT NULL,
  `text` text NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1;

CREATE TABLE IF NOT EXISTS `language` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `lang` varchar(5) NOT NULL,
  `ident` varchar(64) NOT NULL,
  `text` varchar(256) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1;

ALTER TABLE `bot_channels` ADD `suspended` TINYINT( 1 ) NOT NULL;

ALTER TABLE `users` ADD UNIQUE (`user_user`);

ALTER TABLE `noinvite` ADD INDEX ( `cid`, `uid` );

CREATE TABLE IF NOT EXISTS `version` (
  `database_version` int(5) NOT NULL,
  PRIMARY KEY (`database_version`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

INSERT INTO `version` (`database_version`) VALUES (1);

INSERT INTO `channels` (`channel_name`, `channel_key`, `channel_maxusers`, `channel_lastvisit`, `channel_lastgiveowner`, `channel_pubcmd`, `channel_nodelete`, `channel_nogaccess`, `channel_canadd`, `channel_candel`, `channel_canclvl`, `channel_cankick`, `channel_canban`, `channel_staticban`, `channel_protect`, `channel_canop`, `channel_canvoice`, `channel_getop`, `channel_getvoice`, `channel_greeting`, `channel_usergreeting`, `channel_userinfo`, `channel_scanstate`, `channel_scanexcept`, `channel_maxrepeat`, `channel_repeatreaction`, `channel_maxflood`, `channel_floodtime`, `channel_floodreaction`, `channel_maxjoin`, `channel_jointime`, `channel_joinreaction`, `channel_dynlimit`, `channel_getinvite`, `channel_topicmask`, `channel_exttopic`, `channel_exttopic_topic`, `channel_defaulttopic`, `channel_wipeinfo`, `channel_modes`, `channel_enfmodes`, `channel_enftopic`, `channel_topicsnarf`, `channel_changetopic`, `channel_setters`, `channel_canresync`, `channel_cansuspend`, `channel_notice`, `channel_noticereaction`, `channel_ctcp`, `channel_ctcpreaction`, `channel_registered`, `channel_registrator`, `channel_toys`) VALUES
('defaults', '', 0, 0, 0, 0, 0, 0, 300, 300, 300, 200, 200, 250, 0, 200, 200, 200, 100, '', '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '', 0, '', '', 300, '+', 400, 400, 501, 200, 400, 200, 300, 0, 0, 0, 0, 0, 0, 0);
