Database design for email messaging system

后端 未结 9 884
情书的邮戳
情书的邮戳 2021-01-29 22:58

I want to make an email messaging system like gmail have. I would like to have following option: Starred, Trash, Spam, Draft, Read, Unread. Right now I have the below following

9条回答
  •  粉色の甜心
    2021-01-29 23:48

    CREATE TABLE `mails` (  
      `message_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,  
      `message` varchar(10000) NOT NULL DEFAULT '',  
      `file` longblob,  
      `mailingdate` varchar(40) DEFAULT NULL,  
      `starred_status` int(10) unsigned NOT NULL DEFAULT '0',  
      `sender_email` varchar(200) NOT NULL DEFAULT '',  
      `reciever_email` varchar(200) NOT NULL DEFAULT '',  
      `inbox_status` int(10) unsigned NOT NULL DEFAULT '0',   
      `sent_status` int(10) unsigned NOT NULL DEFAULT '0',  
      `draft_status` int(10) unsigned NOT NULL DEFAULT '0',  
      `trash_status` int(10) unsigned NOT NULL DEFAULT '0',  
      `subject` varchar(200) DEFAULT NULL,  
      `read_status` int(10) unsigned NOT NULL DEFAULT '0',  
      `delete_status` int(10) unsigned NOT NULL DEFAULT '0',  
      PRIMARY KEY (`message_id`)  
    )
    

    You can use this table for storing the mails and manipulate the queries according to mail boxes. I am avoiding rest of the tables like user details and login details table. You can make them according to your need.

提交回复
热议问题