| 1 | # frozen_string_literal: true |
| 2 | |
| 3 | class AddDeviseToUsers < ActiveRecord::Migration[6.1] |
| 4 | def self.up |
| 5 | change_table :users do |t| |
| 6 | ## Database authenticatable |
| 7 | #t.string :email, null: false, default: "" |
| 8 | t.string :encrypted_password, null: false, default: "" |
| 9 | |
| 10 | ## Recoverable |
| 11 | t.string :reset_password_token |
| 12 | t.datetime :reset_password_sent_at |
| 13 | |
| 14 | ## Rememberable |
| 15 | t.datetime :remember_created_at |
| 16 | |
| 17 | ## Trackable |
| 18 | # t.integer :sign_in_count, default: 0, null: false |
| 19 | # t.datetime :current_sign_in_at |
| 20 | # t.datetime :last_sign_in_at |
| 21 | # t.string :current_sign_in_ip |
| 22 | # t.string :last_sign_in_ip |
| 23 | |
| 24 | ## Confirmable |
| 25 | # t.string :confirmation_token |
| 26 | # t.datetime :confirmed_at |
| 27 | # t.datetime :confirmation_sent_at |
| 28 | # t.string :unconfirmed_email # Only if using reconfirmable |
| 29 | |
| 30 | ## Lockable |
| 31 | # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts |
| 32 | # t.string :unlock_token # Only if unlock strategy is :email or :both |
| 33 | # t.datetime :locked_at |
| 34 | |
| 35 | |
| 36 | # Uncomment below if timestamps were not included in your original model. |
| 37 | # t.timestamps null: false |
| 38 | end |
| 39 | |
| 40 | #add_index :users, :email, unique: true |
| 41 | add_index :users, :reset_password_token, unique: true |
| 42 | # add_index :users, :confirmation_token, unique: true |
| 43 | # add_index :users, :unlock_token, unique: true |
| 44 | end |
| 45 | |
| 46 | def self.down |
| 47 | # By default, we don't want to make any assumption about how to roll back a migration when your |
| 48 | # model already existed. Please edit below which fields you would like to remove in this migration. |
| 49 | raise ActiveRecord::IrreversibleMigration |
| 50 | end |
| 51 | end |