Skip to content

Instantly share code, notes, and snippets.

@delba
Created June 5, 2013 18:57
Show Gist options
  • Select an option

  • Save delba/5716254 to your computer and use it in GitHub Desktop.

Select an option

Save delba/5716254 to your computer and use it in GitHub Desktop.
Add unique index
class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
t.string :username
t.string :email
t.string :password_digest
t.index :username, unique: true
t.index :email, unique: true
t.timestamps
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment