implement save of thread and members
This commit is contained in:
@@ -122,11 +122,11 @@ CREATE TABLE app_room (
|
||||
room_name VARCHAR(255) NOT NULL,
|
||||
owner_id INT NOT NULL,
|
||||
message_id INT NOT NULL,
|
||||
isGroup BOOLEAN NOT NULL DEFAULT false,
|
||||
room_type INT NOT NULL DEFAULT 0,
|
||||
notSeen INT NOT NULL DEFAULT 0,
|
||||
lastUpdate TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP(),
|
||||
PRIMARY KEY (room_id),
|
||||
UNIQUE KEY (owner_id, message_id, isGroup),
|
||||
UNIQUE KEY (owner_id, message_id, room_type),
|
||||
FOREIGN KEY (owner_id) REFERENCES address(address_id),
|
||||
FOREIGN KEY (message_id) REFERENCES message(message_id)
|
||||
);
|
||||
@@ -134,14 +134,13 @@ CREATE TABLE app_room (
|
||||
-- 12
|
||||
CREATE TABLE app_thread (
|
||||
room_id INT NOT NULL,
|
||||
parent_room_id INT,
|
||||
root_room_id INT,
|
||||
isDm BOOLEAN NOT NULL DEFAULT false,
|
||||
parent_id INT,
|
||||
root_id INT,
|
||||
PRIMARY KEY (room_id),
|
||||
UNIQUE KEY (room_id, parent_room_id, root_room_id),
|
||||
UNIQUE KEY (room_id, parent_id, root_id),
|
||||
FOREIGN KEY (room_id) REFERENCES app_room(room_id) ON DELETE CASCADE,
|
||||
FOREIGN KEY (parent_room_id) REFERENCES app_room(room_id) ON DELETE SET NULL,
|
||||
FOREIGN KEY (root_room_id) REFERENCES app_room(room_id) ON DELETE SET NULL
|
||||
FOREIGN KEY (parent_id) REFERENCES app_room(room_id) ON DELETE SET NULL,
|
||||
FOREIGN KEY (root_id) REFERENCES app_room(room_id) ON DELETE SET NULL
|
||||
);
|
||||
|
||||
-- 13
|
||||
@@ -157,6 +156,7 @@ CREATE TABLE app_room_message (
|
||||
CREATE TABLE app_room_member (
|
||||
room_id INT NOT NULL,
|
||||
member_id INT NOT NULL,
|
||||
UNIQUE KEY (room_id, member_id),
|
||||
FOREIGN KEY (room_id) REFERENCES app_room(room_id) ON DELETE CASCADE,
|
||||
FOREIGN KEY (member_id) REFERENCES address(address_id)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user