DROP TABLE IF EXISTS privatemsg; CREATE TABLE privatemsg ( id int(10) unsigned not null auto_increment primary key, author int(10) unsigned not null, recipient int(10) unsigned not null, subject varchar(64) not null, message text, timestamp int(11) unsigned not null, new tinyint unsigned not null, hostname varchar(128) not null, key (recipient) ); -- from here if you are upgrading (22/5/03) CREATE TABLE privatemsg_folder ( fid int(10) unsigned not null auto_increment primary key, uid int(10) unsigned not null, name varchar(255) not null ); INSERT INTO privatemsg_folder VALUES (1, 0, "Sent"); # sent messages ALTER TABLE privatemsg ADD folder INT UNSIGNED NOT NULL; ALTER TABLE privatemsg ADD author_del TINYINT UNSIGNED NOT NULL; ALTER TABLE privatemsg ADD recipient_del TINYINT UNSIGNED NOT NULL; ALTER TABLE privatemsg ADD INDEX(folder); ALTER TABLE privatemsg CHANGE hostname hostname VARCHAR(255) NOT NULL; CREATE TABLE privatemsg_archive ( id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, author INT(10) UNSIGNED NOT NULL, recipient INT(10) UNSIGNED NOT NULL, subject VARCHAR(64) NOT NULL, message TEXT NOT NULL, timestamp INT(11) UNSIGNED NOT NULL, hostname VARCHAR(255) NOT NULL, folder INT UNSIGNED NOT NULL, key (recipient) );