add unique index on Users#email
This commit is contained in:
parent
6a9437cad7
commit
2470b514c2
2 changed files with 7 additions and 1 deletions
5
db/migrate/20211219074758_index_users_by_unique_email.rb
Normal file
5
db/migrate/20211219074758_index_users_by_unique_email.rb
Normal 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
3
db/schema.rb
generated
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# 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|
|
create_table "articles", charset: "utf8", force: :cascade do |t|
|
||||||
t.string "name", null: false
|
t.string "name", null: false
|
||||||
|
@ -76,6 +76,7 @@ ActiveRecord::Schema.define(version: 2019_08_11_115732) do
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.boolean "admin", default: false
|
t.boolean "admin", default: false
|
||||||
|
t.index ["email"], name: "index_users_on_email", unique: true
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue