CREATE TABLE `user` ( `id` int, `email` varchar(255), `username` varchar(255), `password` varchar(255), `date_joined` datetime, FOREIGN KEY(`date_joined`) REFERENCES `date` (`joined`) ); CREATE TABLE `conversation` ( `id` int, `user_id` int, `date_created` datetime, FOREIGN KEY(`user_id`) REFERENCES `user` (`id`), FOREIGN KEY(`date_created`) REFERENCES `date` (`created`) ); CREATE TABLE `message` ( `id` int, `conversation_id` int, `body` varchar(255), `date_created` datetime, FOREIGN KEY(`conversation_id`) REFERENCES `conversation` (`id`), FOREIGN KEY(`date_created`) REFERENCES `date` (`created`) ); CREATE TABLE `recipient` ( `user_id` int, `conversation_id` int, `is_read` bool, FOREIGN KEY(`user_id`) REFERENCES `user` (`id`), FOREIGN KEY(`conversation_id`) REFERENCES `conversation` (`id`) );