title: Database Design for storing Chat Messages between people
body: <p>I am trying to build a messaging/chat system. which can store conversation between two people in a chronological order. Also if User A deletes the conversation User B still should have access the conversation until he wishes to delete them.</p>
  
  <ol>
  <li><p>Inbox - All the messages recieved by the user from various users will be displayed with the latest message from that particular thread.</p></li>
  <li><p>Conversation Screen - Chronological order of the conversation between the User A and User B</p></li>
  </ol>
  
  <p>This is the basic structure of the database i have come up with. Should i store the messages twice in the database ?</p>
  
  <ol>
  <li>id</li>
  <li>to_id</li>
  <li>from_id</li>
  <li>message</li>
  <li>timestamp</li>
  <li>read</li>
  </ol>