add unique index on Users#email

main
JuliusR 8 months ago committed by 1resu
parent e5a9c03eb9
commit dd6d35e3bd
  1. 5
      db/migrate/20211219074758_index_users_by_unique_email.rb
  2. 3
      db/schema.rb

@ -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

@ -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

Loading…
Cancel
Save