title: how to add index conditionally
body: <p>say i have a model</p>
  
  <pre><code>class Post &lt; ActiveRecord::Base
    validates_uniqueness_of :title, :unless =&gt; Proc.new {|p| p.deleted?}
  end
  </code></pre>
  
  <p>The constraint is i can have only 1 post having "foobar" as its title while it's not deleted, and 1+ posts, which are all having deleted to be true, also having "foobar" as their titles. Since ActiveRecord can not guarantee the uniqueness of the title from <a href="http://apidock.com/rails/v3.0.7/ActiveRecord/Validations/ClassMethods/validates_uniqueness_of" rel="noreferrer">this link</a>, I'm trying to add a unique index to the table posts, on columns [:title, :deleted], it will fail the scenario when I try to insert a new deleted post to the db.</p>