Allow user to creates named auth keys with token

This commit is contained in:
Thibault Jouan
2015-05-04 04:34:13 +00:00
parent 7d1274cbb3
commit 763c9789ec
12 changed files with 174 additions and 1 deletions

View File

@@ -0,0 +1,12 @@
class CreateKeys < ActiveRecord::Migration
def change
create_table :keys do |t|
t.timestamps null: false
t.references :user, index: true, foreign_key: true, null: false
t.string :name
t.string :token
end
add_index :keys, :token, unique: true
end
end

View File

@@ -11,11 +11,22 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20110916003929) do
ActiveRecord::Schema.define(version: 20150504043016) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
create_table "keys", force: :cascade do |t|
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "user_id", null: false
t.string "name"
t.string "token"
end
add_index "keys", ["token"], name: "index_keys_on_token", unique: true, using: :btree
add_index "keys", ["user_id"], name: "index_keys_on_user_id", using: :btree
create_table "playlists", force: :cascade do |t|
t.integer "user_id"
t.string "name"
@@ -56,4 +67,5 @@ ActiveRecord::Schema.define(version: 20110916003929) do
add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
add_foreign_key "keys", "users"
end