Sha256: b3c96e2742b21ed8275d2a1ac25de2bf245e65b2cd9321c31b6f2150560e6dda

Contents?: true

Size: 1.3 KB

Versions: 1

Compression:

Stored size: 1.3 KB

Contents

class ChallahCreateUsers < ActiveRecord::Migration<%= migration_version %>
  def change
     create_table :users do |t|
      t.string      :first_name
      t.string      :last_name
      t.string      :email
      t.string      :email_hash
      t.string      :persistence_token
      t.string      :api_key
      t.datetime    :last_session_at
      t.integer     :session_count, default: 0
      t.integer     :failed_auth_count, default: 0
      t.integer     :created_by, default: 0
      t.integer     :updated_by, default: 0
      t.datetime    :created_at
      t.datetime    :updated_at
      t.integer     :status, default: 0 # defaults to :active
      t.timestamps  null: true
    end

    add_index :users, :first_name
    add_index :users, :last_name
    add_index :users, :email
    add_index :users, :api_key

    create_table :authorizations do |t|
      t.integer     :user_id
      t.string      :provider, limit: 50
      t.string      :uid
      t.string      :token, limit: 500
      t.datetime    :expires_at
      t.datetime    :last_session_at
      t.integer     :session_count, default: 0
      t.timestamps  null: true
    end

    add_index :authorizations, :user_id
    add_index :authorizations, [ :user_id, :provider ]
    add_index :authorizations, :uid
    add_index :authorizations, :token
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
challah-1.6.1 lib/generators/templates/migration.rb