diff --git a/app/models/user.rb b/app/models/user.rb index 84de3d9..2104185 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -3,18 +3,26 @@ # Table name: users # # id :bigint not null, primary key +# confirmation_sent_at :datetime +# confirmation_token :string +# confirmed_at :datetime # email :string default(""), not null # encrypted_password :string default(""), not null -# remember_created_at :datetime +# failed_attempts :integer default(0), not null +# locked_at :datetime # reset_password_sent_at :datetime # reset_password_token :string +# unconfirmed_email :string +# unlock_token :string # created_at :datetime not null # updated_at :datetime not null # # Indexes # +# index_users_on_confirmation_token (confirmation_token) UNIQUE # index_users_on_email (email) UNIQUE # index_users_on_reset_password_token (reset_password_token) UNIQUE +# index_users_on_unlock_token (unlock_token) UNIQUE # class User < ApplicationRecord devise :database_authenticatable, :registerable, diff --git a/db/migrate/20241130095753_devise_create_users.rb b/db/migrate/20241130095753_devise_create_users.rb index 74745e4..718cea0 100644 --- a/db/migrate/20241130095753_devise_create_users.rb +++ b/db/migrate/20241130095753_devise_create_users.rb @@ -12,7 +12,7 @@ class DeviseCreateUsers < ActiveRecord::Migration[8.0] t.datetime :reset_password_sent_at ## Rememberable - t.datetime :remember_created_at + # t.datetime :remember_created_at ## Trackable # t.integer :sign_in_count, default: 0, null: false @@ -22,15 +22,15 @@ class DeviseCreateUsers < ActiveRecord::Migration[8.0] # t.string :last_sign_in_ip ## Confirmable - # t.string :confirmation_token - # t.datetime :confirmed_at - # t.datetime :confirmation_sent_at - # t.string :unconfirmed_email # Only if using reconfirmable + t.string :confirmation_token + t.datetime :confirmed_at + t.datetime :confirmation_sent_at + t.string :unconfirmed_email # Only if using reconfirmable ## Lockable - # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts - # t.string :unlock_token # Only if unlock strategy is :email or :both - # t.datetime :locked_at + t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts + t.string :unlock_token # Only if unlock strategy is :email or :both + t.datetime :locked_at t.timestamps null: false @@ -38,7 +38,7 @@ class DeviseCreateUsers < ActiveRecord::Migration[8.0] add_index :users, :email, unique: true add_index :users, :reset_password_token, unique: true - # add_index :users, :confirmation_token, unique: true - # add_index :users, :unlock_token, unique: true + add_index :users, :confirmation_token, unique: true + add_index :users, :unlock_token, unique: true end end diff --git a/db/schema.rb b/db/schema.rb index 7976090..4297661 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -191,11 +191,19 @@ ActiveRecord::Schema[8.0].define(version: 2024_11_30_095753) do t.string "encrypted_password", default: "", null: false t.string "reset_password_token" t.datetime "reset_password_sent_at" - t.datetime "remember_created_at" + t.string "confirmation_token" + t.datetime "confirmed_at" + t.datetime "confirmation_sent_at" + t.string "unconfirmed_email" + t.integer "failed_attempts", default: 0, null: false + t.string "unlock_token" + t.datetime "locked_at" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true t.index ["email"], name: "index_users_on_email", unique: true t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true + t.index ["unlock_token"], name: "index_users_on_unlock_token", unique: true end add_foreign_key "groups", "groups", column: "parent_id"