Commit 1f4ca07e by Trịnh Hoàng Phúc

Merge branch 'feature/rake_task_crawler' into 'master'

Add index unique for table user email

See merge request !4
parents 5d2b9321 d6bb01c2
Pipeline #552 failed with stages
in 0 seconds
......@@ -21,7 +21,7 @@ gem 'jbuilder', '~> 2.7'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use Active Model has_secure_password
# gem 'bcrypt', '~> 3.1.7'
gem 'bcrypt', '~> 3.1.7'
# Use Active Storage variant
# gem 'image_processing', '~> 1.2'
......
......@@ -58,6 +58,7 @@ GEM
zeitwerk (~> 2.2)
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
bcrypt (3.1.13)
bindex (0.8.1)
bootsnap (1.4.6)
msgpack (~> 1.0)
......@@ -232,6 +233,7 @@ PLATFORMS
x86-mswin32
DEPENDENCIES
bcrypt (~> 3.1.7)
bootsnap (>= 1.4.2)
byebug
capybara (>= 2.15)
......
......@@ -3,4 +3,8 @@ class User < ApplicationRecord
has_many :jobs, through: :applies
has_many :favorites
has_many :jobs, through: :favorites
has_secure_password
validates :email, uniqueness: { message: "Email is exist"}
end
......@@ -8,5 +8,6 @@ class CreateUsers < ActiveRecord::Migration[6.0]
t.timestamps
end
add_index :users, :email, unique: true
end
end
......@@ -86,6 +86,7 @@ ActiveRecord::Schema.define(version: 2020_04_03_070245) do
t.string "cv_of_user"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["email"], name: "index_users_on_email", unique: true
end
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