1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-10-31 14:10:08 +00:00

Updating database structure

This commit is contained in:
Tim Düsterhus 2011-11-27 12:34:02 +01:00
parent 6bc4285f30
commit 35a22767fc

View File

@ -3,15 +3,15 @@ CREATE TABLE wcf1_chat_message (
messageID int(10) NOT NULL AUTO_INCREMENT, messageID int(10) NOT NULL AUTO_INCREMENT,
roomID int(10) NOT NULL, roomID int(10) NOT NULL,
sender int(10) DEFAULT NULL, sender int(10) DEFAULT NULL,
username varchar(255) NOT NULL, username varchar(255) DEFAULT NULL,
receiver int(10) NOT NULL, receiver int(10) DEFAULT NULL,
"time" int(10) NOT NULL, time int(10) NOT NULL,
"type" tinyint(3) NOT NULL, type tinyint(3) NOT NULL DEFAULT 1,
message mediumtext NOT NULL, message mediumtext NOT NULL,
enableSmilies tinyint(1) NOT NULL, enableSmilies tinyint(1) NOT NULL DEFAULT 1,
enableHTML tinyint(1) NOT NULL, enableHTML tinyint(1) NOT NULL DEFAULT 0,
color1 int(10) NOT NULL, color1 int(10) NOT NULL DEFAULT 0,
color2 int(10) NOT NULL, color2 int(10) NOT NULL DEFAULT 0,
PRIMARY KEY (messageID), PRIMARY KEY (messageID),
KEY roomID (roomID), KEY roomID (roomID),
KEY sender (sender), KEY sender (sender),
@ -25,15 +25,15 @@ CREATE TABLE wcf1_chat_room (
topic varchar(255) NOT NULL, topic varchar(255) NOT NULL,
position int(10) NOT NULL DEFAULT '0', position int(10) NOT NULL DEFAULT '0',
permanent tinyint(1) NOT NULL DEFAULT '1', permanent tinyint(1) NOT NULL DEFAULT '1',
"owner" int(10) DEFAULT NULL, owner int(10) DEFAULT NULL,
PRIMARY KEY (roomID), PRIMARY KEY (roomID),
KEY position (position), KEY position (position),
KEY "owner" ("owner") KEY owner (owner)
); );
ALTER TABLE wcf1_chat_message ADD FOREIGN KEY (receiver) REFERENCES wcf1_user (userID) ON DELETE CASCADE; ALTER TABLE wcf1_chat_message ADD FOREIGN KEY (receiver) REFERENCES wcf1_user (userID) ON DELETE CASCADE;
ALTER TABLE wcf1_chat_message ADD FOREIGN KEY (roomID) REFERENCES wcf1_chat_room (roomID) ON DELETE CASCADE, ALTER TABLE wcf1_chat_message ADD FOREIGN KEY (roomID) REFERENCES wcf1_chat_room (roomID) ON DELETE CASCADE;
ALTER TABLE wcf1_chat_message ADD FOREIGN KEY (sender) REFERENCES wcf1_user (userID) ON DELETE SET NULL; ALTER TABLE wcf1_chat_message ADD FOREIGN KEY (sender) REFERENCES wcf1_user (userID) ON DELETE SET NULL;
ALTER TABLE wcf1_chat_room ADD FOREIGN KEY ("owner") REFERENCES wcf1_user (userID) ON DELETE SET NULL; ALTER TABLE wcf1_chat_room ADD FOREIGN KEY (owner) REFERENCES wcf1_user (userID) ON DELETE SET NULL;