Allow user to creates named auth keys with token
This commit is contained in:
12
db/migrate/20150504043016_create_keys.rb
Normal file
12
db/migrate/20150504043016_create_keys.rb
Normal 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
|
14
db/schema.rb
14
db/schema.rb
@@ -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
|
||||
|
Reference in New Issue
Block a user