load message in front

This commit is contained in:
grimhilt
2023-03-25 13:06:59 +01:00
parent cb5021750a
commit 097dd8bf21
12 changed files with 246 additions and 131 deletions

View File

@@ -131,25 +131,24 @@ CREATE TABLE app_room (
-- 12
CREATE TABLE app_thread (
thread_id INT AUTO_INCREMENT,
room_id INT NOT NULL,
thread_name VARCHAR(255) NOT NULL,
notSeen INT NOT NULL DEFAULT 0,
lastUpdate TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP(),
parent_room_id INT,
root_room_id INT,
isDm BOOLEAN NOT NULL DEFAULT false,
PRIMARY KEY (thread_id),
FOREIGN KEY (room_id) REFERENCES app_room(room_id) ON DELETE CASCADE
PRIMARY KEY (room_id),
UNIQUE KEY (room_id, parent_room_id, root_room_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
);
-- 13
CREATE TABLE app_space_message (
CREATE TABLE app_room_message (
message_id INT NOT NULL,
room_id INT,
thread_id INT,
UNIQUE KEY (message_id, room_id, thread_id),
UNIQUE KEY (message_id, room_id),
FOREIGN KEY (message_id) REFERENCES message(message_id) ON DELETE CASCADE,
FOREIGN KEY (room_id) REFERENCES app_room(room_id) ON DELETE SET NULL,
FOREIGN KEY (thread_id) REFERENCES app_thread(thread_id) ON DELETE SET NULL
FOREIGN KEY (room_id) REFERENCES app_room(room_id) ON DELETE SET NULL
);
-- 14
@@ -159,11 +158,3 @@ CREATE TABLE app_room_member (
FOREIGN KEY (room_id) REFERENCES app_room(room_id) ON DELETE CASCADE,
FOREIGN KEY (member_id) REFERENCES address(address_id)
);
-- 14
CREATE TABLE app_thread_member (
thread_id INT NOT NULL,
member_id INT NOT NULL,
FOREIGN KEY (thread_id) REFERENCES app_thread(thread_id) ON DELETE CASCADE,
FOREIGN KEY (member_id) REFERENCES address(address_id)
);