wedding-planner/db/migrate/20241130095753_devise_create_users.rb

49 lines
1.5 KiB
Ruby
Raw Permalink Normal View History

2025-01-13 20:38:47 +00:00
# Copyright (C) 2024 Manuel Bustillo
# Copyright (C) 2024-2025 LibreWeddingPlanner contributors
2024-11-30 10:03:46 +00:00
2024-11-30 10:59:28 +01:00
# frozen_string_literal: true
class DeviseCreateUsers < ActiveRecord::Migration[8.0]
def change
create_table :users, id: :uuid do |t|
2024-11-30 10:59:28 +01:00
## 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
2024-11-30 11:01:44 +01:00
# t.datetime :remember_created_at
2024-11-30 10:59:28 +01:00
## Trackable
# t.integer :sign_in_count, default: 0, null: false
# t.datetime :current_sign_in_at
# t.datetime :last_sign_in_at
# t.string :current_sign_in_ip
# t.string :last_sign_in_ip
## Confirmable
2024-11-30 11:01:44 +01:00
t.string :confirmation_token
t.datetime :confirmed_at
t.datetime :confirmation_sent_at
t.string :unconfirmed_email # Only if using reconfirmable
2024-11-30 10:59:28 +01:00
## Lockable
2024-11-30 11:01:44 +01:00
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
2024-11-30 10:59:28 +01:00
t.timestamps null: false
end
add_index :users, :email, unique: true
add_index :users, :reset_password_token, unique: true
2024-11-30 11:01:44 +01:00
add_index :users, :confirmation_token, unique: true
add_index :users, :unlock_token, unique: true
2024-11-30 10:59:28 +01:00
end
end