add unique index on Users#email

This commit is contained in:
JuliusR 2021-12-19 10:17:27 +01:00 committed by 1resu
parent e5a9c03eb9
commit dd6d35e3bd
2 changed files with 7 additions and 1 deletions

View file

@ -0,0 +1,5 @@
class IndexUsersByUniqueEmail < ActiveRecord::Migration[6.1]
def change
add_index :users, :email, unique: true
end
end

3
db/schema.rb generated
View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2019_08_11_115732) do
ActiveRecord::Schema.define(version: 2021_12_19_074758) do
create_table "articles", charset: "utf8", force: :cascade do |t|
t.string "name", null: false
@ -76,6 +76,7 @@ ActiveRecord::Schema.define(version: 2019_08_11_115732) do
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "admin", default: false
t.index ["email"], name: "index_users_on_email", unique: true
end
end