1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-21 21:30:08 +00:00
Tims-Chat/sql/0004-chat1_message.sql
2018-08-17 00:30:59 +02:00

17 lines
956 B
SQL

CREATE TABLE chat1_message ( messageID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY
, time INT(10) NOT NULL
, roomID INT(10) NOT NULL
, userID INT(10) DEFAULT NULL
, username VARCHAR(255) NOT NULL
, objectTypeID INT(10) NOT NULL
, payload MEDIUMBLOB NOT NULL
, KEY (roomID)
, KEY (userID)
, KEY (time)
);
ALTER TABLE chat1_message ADD FOREIGN KEY (userID) REFERENCES wcf1_user (userID) ON DELETE SET NULL;
ALTER TABLE chat1_message ADD FOREIGN KEY (roomID) REFERENCES chat1_room (roomID) ON DELETE CASCADE;
ALTER TABLE chat1_message ADD FOREIGN KEY (objectTypeID) REFERENCES wcf1_object_type (objectTypeID) ON DELETE CASCADE;