Skip to content

Instantly share code, notes, and snippets.

@scaffeinate
Created June 8, 2016 10:13
Show Gist options
  • Save scaffeinate/f12348f33637a36f32788622c63374e0 to your computer and use it in GitHub Desktop.
Save scaffeinate/f12348f33637a36f32788622c63374e0 to your computer and use it in GitHub Desktop.
Rails 5 API Migration
class CreateUsers < ActiveRecord::Migration[5.0]
def change
create_table :users do |t|
t.string :first_name, null: false, default: ''
t.string :last_name, null: false, default: ''
t.string :email, null: false
t.timestamps
end
add_index :users, :email, unique: true
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment