class CreateContacts < ActiveRecord::Migration
  def change
    create_table :contacts do |t|
      t.string :email, unique: true

      t.timestamps
    end
  end
end

class CreateContacts < ActiveRecord::Migration
  def change
    create_table :contacts do |t|
      t.string :email, unique: true
      t.timestamps
    end
    add_index :contacts, :email, :unique => true
  end
end

Add unique index to contacts email
Add unique index to contacts email
