title: Case-insensitive unique index in Rails/ActiveRecord?
body: <p>I need to create a case-insensitive index on a column in rails. I did this via SQL:</p>
  
  <pre><code>execute(
     "CREATE UNIQUE INDEX index_users_on_lower_email_index 
      ON users (lower(email))"
   )
  </code></pre>
  
  <p>This works great, but in my schema.rb file I have:</p>
  
  <pre><code>add_index "users", [nil], 
    :name =&gt; "index_users_on_lower_email_index", 
    :unique =&gt; true
  </code></pre>
  
  <p>Notice the "nil". So when I try to clone the database to run a test, I get an obvious error. Am I doing something wrong here? Is there some other convention that I should be using inside rails?</p>
  
  <p>Thanks for the help.</p>