Commit d6bb01c2 by Hoang Phuc

Add index unique for table user email

parent 64410b1c
Pipeline #551 failed with stages
in 0 seconds
...@@ -21,7 +21,7 @@ gem 'jbuilder', '~> 2.7' ...@@ -21,7 +21,7 @@ gem 'jbuilder', '~> 2.7'
# Use Redis adapter to run Action Cable in production # Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0' # gem 'redis', '~> 4.0'
# Use Active Model has_secure_password # Use Active Model has_secure_password
# gem 'bcrypt', '~> 3.1.7' gem 'bcrypt', '~> 3.1.7'
# Use Active Storage variant # Use Active Storage variant
# gem 'image_processing', '~> 1.2' # gem 'image_processing', '~> 1.2'
......
...@@ -58,6 +58,7 @@ GEM ...@@ -58,6 +58,7 @@ GEM
zeitwerk (~> 2.2) zeitwerk (~> 2.2)
addressable (2.7.0) addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0) public_suffix (>= 2.0.2, < 5.0)
bcrypt (3.1.13)
bindex (0.8.1) bindex (0.8.1)
bootsnap (1.4.6) bootsnap (1.4.6)
msgpack (~> 1.0) msgpack (~> 1.0)
...@@ -232,6 +233,7 @@ PLATFORMS ...@@ -232,6 +233,7 @@ PLATFORMS
x86-mswin32 x86-mswin32
DEPENDENCIES DEPENDENCIES
bcrypt (~> 3.1.7)
bootsnap (>= 1.4.2) bootsnap (>= 1.4.2)
byebug byebug
capybara (>= 2.15) capybara (>= 2.15)
......
...@@ -3,4 +3,8 @@ class User < ApplicationRecord ...@@ -3,4 +3,8 @@ class User < ApplicationRecord
has_many :jobs, through: :applies has_many :jobs, through: :applies
has_many :favorites has_many :favorites
has_many :jobs, through: :favorites has_many :jobs, through: :favorites
has_secure_password
validates :email, uniqueness: { message: "Email is exist"}
end end
...@@ -8,5 +8,6 @@ class CreateUsers < ActiveRecord::Migration[6.0] ...@@ -8,5 +8,6 @@ class CreateUsers < ActiveRecord::Migration[6.0]
t.timestamps t.timestamps
end end
add_index :users, :email, unique: true
end end
end end
...@@ -86,6 +86,7 @@ ActiveRecord::Schema.define(version: 2020_04_03_070245) do ...@@ -86,6 +86,7 @@ ActiveRecord::Schema.define(version: 2020_04_03_070245) do
t.string "cv_of_user" t.string "cv_of_user"
t.datetime "created_at", precision: 6, null: false t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false
t.index ["email"], name: "index_users_on_email", unique: true
end end
add_foreign_key "applies", "jobs" add_foreign_key "applies", "jobs"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment