add unique indexes to users

This commit is contained in:
Lee Lawlor 2014-05-16 12:57:29 -04:00
parent 72d78da0e9
commit a74b7ab5b8
2 changed files with 17 additions and 6 deletions

View File

@ -0,0 +1,11 @@
class AddUniqueIndexesToUsers < ActiveRecord::Migration
def change
remove_index "users", ["email"]
add_index "users", ["email"], unique: true
remove_index "users", ["login"]
add_index "users", ["login"], unique: true
remove_index "users", ["authentication_token"]
add_index "users", ["authentication_token"], unique: true
end
end

View File

@ -11,13 +11,13 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20140515161337) do
ActiveRecord::Schema.define(version: 20140516162515) do
create_table "active_admin_comments", force: true do |t|
t.string "namespace"
t.text "body"
t.string "resource_id", null: false
t.string "resource_type", null: false
t.string "resource_id", limit: 50, null: false
t.string "resource_type", limit: 50, null: false
t.integer "author_id"
t.string "author_type"
t.datetime "created_at"
@ -408,9 +408,9 @@ ActiveRecord::Schema.define(version: 20140515161337) do
end
add_index "users", ["api_key"], name: "index_users_on_api_key", using: :btree
add_index "users", ["authentication_token"], name: "index_users_on_authentication_token", using: :btree
add_index "users", ["email"], name: "index_users_on_email", using: :btree
add_index "users", ["login"], name: "index_users_on_login", using: :btree
add_index "users", ["authentication_token"], name: "index_users_on_authentication_token", unique: true, using: :btree
add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
add_index "users", ["login"], name: "index_users_on_login", unique: true, using: :btree
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
create_table "watchings", force: true do |t|