Add pointer from chan to the last msg, add messages_queue table
This commit is contained in:
parent
81b6f2e608
commit
b75becd960
@ -25,12 +25,14 @@ CREATE TABLE teams (
|
||||
-- Keeps all known channels
|
||||
CREATE TABLE channels (
|
||||
id BIGINT UNSIGNED NOT NULL,
|
||||
label TEXT NOT NULL, -- display name of the channel
|
||||
name TEXT NOT NULL, -- display name of the channel
|
||||
meta JSON NOT NULL,
|
||||
|
||||
archived_at DATETIME NULL,
|
||||
deleted_at DATETIME NULL, -- channel soft delete
|
||||
|
||||
rel_last_message BIGINT UNSIGNED,
|
||||
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
@ -102,6 +104,19 @@ CREATE TABLE messages (
|
||||
);
|
||||
|
||||
|
||||
-- temp copy of messages (when they are pushed to the primary organisation, row gets removed)
|
||||
CREATE TABLE messages_queue (
|
||||
id BIGINT UNSIGNED NOT NULL,
|
||||
mimetype VARCHAR(255) NULL,
|
||||
body TEXT NULL,
|
||||
rel_user BIGINT UNSIGNED NOT NULL REFERENCES users(id),
|
||||
rel_channel BIGINT UNSIGNED NOT NULL REFERENCES channels(id),
|
||||
rel_message BIGINT UNSIGNED NOT NULL REFERENCES messages(id),
|
||||
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
|
||||
CREATE TABLE channel_views (
|
||||
rel_channel BIGINT UNSIGNED NOT NULL REFERENCES channels(id),
|
||||
rel_user BIGINT UNSIGNED NOT NULL REFERENCES users(id),
|
||||
@ -113,4 +128,4 @@ CREATE TABLE channel_views (
|
||||
new_since INT UNSIGNED NOT NULL DEFAULT 0,
|
||||
|
||||
PRIMARY KEY (rel_user, rel_channel)
|
||||
);
|
||||
);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user