Skip to content

Instantly share code, notes, and snippets.

@mscoutermarsh
Last active October 13, 2015 04:47
Show Gist options
  • Select an option

  • Save mscoutermarsh/4141710 to your computer and use it in GitHub Desktop.

Select an option

Save mscoutermarsh/4141710 to your computer and use it in GitHub Desktop.
api key migration
class CreateApiKeys < ActiveRecord::Migration
def change
create_table :api_keys do |t|
t.string :access_token, null: false
t.integer :user_id, null: false
t.boolean :active, null: false, default: true
t.datetime :expires_at
t.timestamps
end
add_index :api_keys, ["user_id"], name: "index_api_keys_on_user_id", unique: false
add_index :api_keys, ["access_token"], name: "index_api_keys_on_access_token", unique: true
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment