36436-vm/db/migrations/007_create_messages_table.sql
Flatlogic Bot 2a74e9787f v1
2025-11-28 17:43:30 +00:00

12 lines
375 B
SQL

CREATE TABLE IF NOT EXISTS `messages` (
`id` INT AUTO_INCREMENT PRIMARY KEY,
`sender_id` INT NOT NULL,
`recipient_id` INT NOT NULL,
`content` TEXT NOT NULL,
`is_read` BOOLEAN NOT NULL DEFAULT FALSE,
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (`sender_id`) REFERENCES `users`(`id`),
FOREIGN KEY (`recipient_id`) REFERENCES `users`(`id`)
);