CREATE TABLE IF NOT EXISTS chatlog (
id INTEGER PRIMARY KEY AUTOINCREMENT,
msg_time INTEGER(10) NOT NULL,
msg_type VARCHAR(16) NOT NULL,
client_id INTEGER(11) NOT NULL,
client_name VARCHAR(32) NOT NULL,
client_team SMALLINT(1) NOT NULL,
msg VARCHAR(528) NOT NULL,
target_id INTEGER(11) DEFAULT NULL,
target_name VARCHAR(32) DEFAULT NULL,
target_team TINYINT(1) DEFAULT NULL,
FOREIGN KEY(client_id) REFERENCES clients(id));

CREATE TABLE IF NOT EXISTS cmdlog (
id INTEGER PRIMARY KEY AUTOINCREMENT,
cmd_time INTEGER(10) NOT NULL,
admin_id INTEGER(11) NOT NULL,
admin_name VARCHAR(32) NOT NULL,
command VARCHAR(100) NOT NULL,
data VARCHAR(528) DEFAULT NULL,
result VARCHAR(528) DEFAULT NULL,
FOREIGN KEY(admin_id) REFERENCES clients(id));