Skip to content

Instantly share code, notes, and snippets.

@delba
Created July 1, 2013 16:19
Show Gist options
  • Select an option

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

Select an option

Save delba/5902284 to your computer and use it in GitHub Desktop.
Migrations
$ rails g model user email
=begin
create_table :users do |t|
t.string :email
t.timestamp
end
=end
$ rails g model user email:index
=begin
create_table :users do |t|
t.string :email
t.timestamp
end
add_index :users, :email
=end
$ rails g model user email:uniq
=begin
create_table :users do |t|
t.string :email
t.timestamp
end
add_index :users, :email, unique: true
=end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment