diff --git a/db/migrate/20140516162515_add_unique_indexes_to_users.rb b/db/migrate/20140516162515_add_unique_indexes_to_users.rb new file mode 100644 index 0000000..fb223e9 --- /dev/null +++ b/db/migrate/20140516162515_add_unique_indexes_to_users.rb @@ -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 + diff --git a/db/schema.rb b/db/schema.rb index a5de4ea..8613a47 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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|