14 lines
532 B
SQL
14 lines
532 B
SQL
-- Migration to add attachments and reactions
|
|
ALTER TABLE messages ADD COLUMN attachment_url VARCHAR(255) AFTER content;
|
|
|
|
CREATE TABLE IF NOT EXISTS message_reactions (
|
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
|
message_id INT NOT NULL,
|
|
user_id INT NOT NULL,
|
|
emoji VARCHAR(50) NOT NULL,
|
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
UNIQUE KEY (message_id, user_id, emoji),
|
|
FOREIGN KEY (message_id) REFERENCES messages(id) ON DELETE CASCADE,
|
|
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
|
|
);
|