use devise instead auth0
This commit is contained in:
36
db/migrate/20210808153626_add_devise_to_users.rb
Normal file
36
db/migrate/20210808153626_add_devise_to_users.rb
Normal file
@@ -0,0 +1,36 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class AddDeviseToUsers < ActiveRecord::Migration[6.1]
|
||||
def self.up
|
||||
change_table(:users, bulk: true) do |t|
|
||||
## Database authenticatable
|
||||
# t.string(:email, null: false, default: "")
|
||||
t.string(:encrypted_password, null: false, default: "")
|
||||
|
||||
## Recoverable
|
||||
t.string(:reset_password_token)
|
||||
t.datetime(:reset_password_sent_at)
|
||||
|
||||
## Rememberable
|
||||
t.datetime(:remember_created_at)
|
||||
end
|
||||
|
||||
change_column_default(:users, :email, "")
|
||||
|
||||
# add_index(:users, :email, unique: true)
|
||||
add_index(:users, :reset_password_token, unique: true)
|
||||
end
|
||||
|
||||
def self.down
|
||||
change_column_default(:users, :email, nil)
|
||||
|
||||
change_table(:users, bulk: true) do |t|
|
||||
t.remove(:encrypted_password)
|
||||
t.remove(:reset_password_token)
|
||||
t.remove(:reset_password_sent_at)
|
||||
t.remove(:remember_created_at)
|
||||
end
|
||||
|
||||
remove_index(:users, :reset_password_token)
|
||||
end
|
||||
end
|
||||
9
db/schema.rb
generated
9
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: 2021_08_05_000225) do
|
||||
ActiveRecord::Schema.define(version: 2021_08_08_153626) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
@@ -66,10 +66,15 @@ ActiveRecord::Schema.define(version: 2021_08_05_000225) do
|
||||
create_table "users", force: :cascade do |t|
|
||||
t.string "first_name", null: false
|
||||
t.string "last_name", null: false
|
||||
t.string "email", null: false
|
||||
t.string "email", default: "", null: false
|
||||
t.datetime "created_at", precision: 6, null: false
|
||||
t.datetime "updated_at", precision: 6, null: false
|
||||
t.string "encrypted_password", default: "", null: false
|
||||
t.string "reset_password_token"
|
||||
t.datetime "reset_password_sent_at"
|
||||
t.datetime "remember_created_at"
|
||||
t.index ["email"], name: "index_users_on_email", unique: true
|
||||
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
||||
end
|
||||
|
||||
add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
|
||||
|
||||
Reference in New Issue
Block a user