9 lines
338 B
SQL
9 lines
338 B
SQL
CREATE TABLE IF NOT EXISTS messages (
|
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
|
conversation_id INT NOT NULL,
|
|
sender_id INT NOT NULL,
|
|
message_text TEXT NOT NULL,
|
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
FOREIGN KEY (conversation_id) REFERENCES conversations(id),
|
|
FOREIGN KEY (sender_id) REFERENCES users(id)
|
|
); |