DROP TABLE IF EXISTS message_drop;
CREATE TABLE message_drop (
        id      INT(11) NOT NULL auto_increment,
        user    INT(11) NOT NULL,
        fuser   INT(11) DEFAULT '0' NOT NULL,
        code    INT(11) DEFAULT '-1' NOT NULL,
        date    TIMESTAMP NOT NULL,
        altto   VARCHAR(50) DEFAULT '' NOT NULL,
        message BLOB DEFAULT '' NOT NULL,
        PRIMARY KEY (id)
) TYPE=MYISAM;

DROP TABLE IF EXISTS message_web;
CREATE TABLE message_web (
        id      INT(11) NOT NULL,
        user    INT(11) NOT NULL,
        fuser   INT(11) DEFAULT '0' NOT NULL,
        code    INT(11) DEFAULT '-1' NOT NULL,
        updated TIMESTAMP NOT NULL,
        readed  TINYINT(1) DEFAULT '0' NOT NULL,
        date    TIMESTAMP NOT NULL,
        KEY (fuser),
        KEY (user),
        PRIMARY KEY (id)
);

DROP TABLE IF EXISTS message_web_text;
CREATE TABLE message_web_text (
        id      INT(11) NOT NULL,
        subject BLOB DEFAULT '' NOT NULL,
        message BLOB DEFAULT '' NOT NULL,
        PRIMARY KEY (id)
);

DROP TABLE IF EXISTS message_codes;
CREATE TABLE message_codes (
        code    INT(11) NOT NULL,
        type    VARCHAR(32) NOT NULL,
        seclev  INT(11) DEFAULT '1' NOT NULL,
        modes   VARCHAR(32) DEFAULT '' NOT NULL,
        PRIMARY KEY (code)
);

DROP TABLE IF EXISTS message_log;
CREATE TABLE message_log (
        id      INT(11) DEFAULT '0' NOT NULL,
        user    INT(11) NOT NULL,
        fuser   INT(11) DEFAULT '0' NOT NULL,
        code    INT(11) DEFAULT '-1' NOT NULL,
        mode    INT(11) NOT NULL,
        date    TIMESTAMP NOT NULL
);
