-- Database upgrades (running all SQL commands below the matching "-- version: x" line)

-- version: 1

CREATE TABLE `support_ranks` (
`rank_id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`rank_name` VARCHAR( 256 ) NOT NULL ,
`rank_access` INT( 4 ) NOT NULL ,
`rank_info` VARCHAR( 512 ) NOT NULL ,
`rank_order` SMALLINT( 4 ) NOT NULL
) ENGINE = MYISAM ;

ALTER TABLE `users` ADD `user_rank` INT( 11 ) NOT NULL AFTER `user_access`;

-- version: 2

ALTER TABLE `owner_history` CHANGE `owner_history_uid` `owner_history_to_uid` INT( 11 ) NOT NULL;
ALTER TABLE `owner_history` ADD `owner_history_from_uid` INT( 11 ) NOT NULL AFTER `owner_history_to_uid`;

-- version: 3

ALTER TABLE `channels`
  DROP `channel_scanstate`,
  DROP `channel_scanexcept`,
  DROP `channel_maxrepeat`,
  DROP `channel_repeatreaction`,
  DROP `channel_maxflood`,
  DROP `channel_floodtime`,
  DROP `channel_floodreaction`,
  DROP `channel_maxjoin`,
  DROP `channel_jointime`,
  DROP `channel_joinreaction`;

ALTER TABLE `channels`  
  ADD `channel_scanner` VARCHAR(50) NULL,  
  ADD `channel_spam_limit` SMALLINT(3) NULL,  
  ADD `channel_spam_reaction` TINYINT(1) NULL,  
  ADD `channel_spam_reaction_duration` MEDIUMINT(7) NULL,  
  ADD `channel_spam_except` SMALLINT(3) NULL,  
  ADD `channel_flood_limit` SMALLINT(3) NULL,  
  ADD `channel_flood_time` SMALLINT(3) NULL,  
  ADD `channel_flood_reaction` TINYINT(1) NULL,  
  ADD `channel_flood_reaction_duration` MEDIUMINT(7) NULL,  
  ADD `channel_flood_except` SMALLINT(3) NULL,  
  ADD `channel_join_limit` SMALLINT(3) NULL,  
  ADD `channel_join_time` SMALLINT(3) NULL,  
  ADD `channel_join_reaction` TINYINT(1) NULL,  
  ADD `channel_join_reaction_duration` MEDIUMINT(7) NULL,  
  ADD `channel_join_except` SMALLINT(3) NULL,  
  ADD `channel_botnet_bantime` MEDIUMINT(7) NULL,  
  ADD `channel_botnet_except` SMALLINT(3) NULL,  
  ADD `channel_caps_percent` TINYINT(3) NULL,  
  ADD `channel_caps_reaction` TINYINT(1) NULL,  
  ADD `channel_caps_reaction_duration` MEDIUMINT(7) NULL,  
  ADD `channel_caps_except` SMALLINT(3) NULL,  
  ADD `channel_digit_percent` TINYINT(3) NULL,  
  ADD `channel_digit_reaction` TINYINT(1) NULL,  
  ADD `channel_digit_reaction_duration` MEDIUMINT(7) NULL,  
  ADD `channel_digit_except` SMALLINT(3) NULL;
  
-- version: 4

ALTER TABLE `bots` ADD `queue` TINYINT( 1 ) NOT NULL AFTER `textbot` 

-- version: 5

CREATE TABLE `donotregister` (
`dnr_id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`dnr_target` VARCHAR( 256 ) NOT NULL ,
`dnr_user` INT( 11 ) NOT NULL ,
`dnr_timeout` INT( 20 ) NOT NULL ,
`dnr_reason` TEXT NOT NULL ,
UNIQUE (
`dnr_target`
)
) ENGINE = MYISAM ;

-- version: 6

ALTER TABLE `fundata` CHANGE `uid` `user` VARCHAR( 50 ) NOT NULL;
ALTER TABLE `fundata` ADD INDEX ( `cid` );
ALTER TABLE `fundata` ADD INDEX ( `user` );
ALTER TABLE `fundata` ADD INDEX ( `name` );

-- version: 7
