title: user relationship table - avoiding duplicates
body: <p>Consider this table:</p>
  
  <pre><code>+---------------------------------------------------------+
  |               relationships                             |
  +---------------------------------------------------------+
  | id | user_id_1  |  user_id_2   |  status_1  |  status_2 |
  +----+------------+--------------+------------------------+
  |    |            |              |            |           |
  |    |            |              |            |           |
  |    |            |              |            |           |
  |    |            |              |            |           |
  +---------------------------------------------------------+
  </code></pre>
  
  <p>I want to constrain, user_id_1 and user_id_2
  I don't want duplicates like:</p>
  
  <pre><code>user_id_1 = 1 and user_id_2 = 2
  user_id_1 = 2 and user_id_2 = 1
  </code></pre>
  
  <p>These two are essentially same for my application.</p>
  
  <p>My strategy to avoid duplication is to order user_id before inserting it, and always put smaller one in user_id_1 and bigger id in user_id_2 thus effectively avoiding the original problem.</p>
  
  <p>But is there a better, cleaner way to achieve the same result?</p>