Bt-mysql

From UbuntuBots

Jump to: navigation, search

This is a little experiment to see if Bantracker can be ported to use MySQL

Contents

Branch

https://code.launchpad.net/~ubuntu-bots/ubuntu-bots/bt-mysql

Setup MySQL

MySQL needs AUTO_INCREMENT in INTEGER PRIMARY KEY or it will always fail to get a new id.

CREATE DATABASE bt;
USE bt
CREATE TABLE bans (                       
   id INTEGER PRIMARY KEY AUTO_INCREMENT,
   channel VARCHAR(30) NOT NULL,         
   mask VARCHAR(100) NOT NULL,           
   operator VARCHAR(30) NOT NULL,        
   time VARCHAR(300) NOT NULL,           
   removal DATETIME,                     
   removal_op VARCHAR(30),               
   log TEXT                              
);                                        
CREATE TABLE comments (                   
   ban_id INTEGER,                       
   who VARCHAR(100) NOT NULL,            
   comment MEDIUMTEXT NOT NULL,          
   time VARCHAR(300) NOT NULL            
);                                        
CREATE TABLE sessions (                   
   session_id VARCHAR(50) PRIMARY KEY,   
   user MEDIUMTEXT NOT NULL,             
   time INT NOT NULL                     
);
GRANT ALL ON bt.* TO bot@locahost IDENFIED BY password;
FLUSH PRIVILEGES;

Configure Plugin

config plugins.Bantracker.database mysql://bot:password@localhost/bt

Status

  • bans seems to be stored correctly
  • @mark works apparently
  • @bansearch and @banlog raises an exception FIXED
  • @bansearch seems to work
  • @banlog gives a "Error: No log for ID 1 available" thing?
  • Didn't test anything else.
Personal tools