Sha256: 74d58d92b13fbe260a699b665283b9bc56c04113dc39b03e9c1b39668b183f5c

Contents?: true

Size: 1.57 KB

Versions: 2

Compression:

Stored size: 1.57 KB

Contents

class CreateAikotobaAccounts < ActiveRecord::Migration[6.1]
  def change
    create_table :aikotoba_accounts do |t|
      t.belongs_to :authenticate_target, polymorphic: true, index: {unique: true}
      t.string :email, null: false, index: {unique: true}
      t.string :password_digest, null: false
      t.boolean :confirmed, null: false, default: false
      t.integer :failed_attempts, null: false, default: 0
      t.boolean :locked, null: false, default: false

      t.timestamps
    end

    create_table :aikotoba_account_confirmation_tokens do |t|
      t.belongs_to(
        :aikotoba_account,
        foreign_key: true, null: false,
        index: {unique: true, name: "index_account_confirmation_tokens_on_account_id"}
      )
      t.string :token, null: false, index: {unique: true}
      t.datetime :expired_at, null: false

      t.timestamps
    end

    create_table :aikotoba_account_unlock_tokens do |t|
      t.belongs_to(
        :aikotoba_account,
        null: false, foreign_key: true,
        index: {unique: true, name: "index_account_unlock_tokens_on_account_id"}
      )
      t.string :token, null: false, index: {unique: true}
      t.datetime :expired_at, null: false

      t.timestamps
    end

    create_table :aikotoba_account_recovery_tokens do |t|
      t.belongs_to(
        :aikotoba_account,
        null: false, foreign_key: true,
        index: {unique: true, name: "index_account_recovery_tokens_on_account_id"}
      )
      t.string :token, null: false, index: {unique: true}
      t.datetime :expired_at, null: false

      t.timestamps
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aikotoba-0.1.1 db/migrate/20211204121532_create_aikotoba_accounts.rb
aikotoba-0.1.0 db/migrate/20211204121532_create_aikotoba_accounts.rb