Sha256: 3c24b655a121efcb8acbebac9aab6cc00862862acc682bdf5c96f90c771f67d1

Contents?: true

Size: 1.87 KB

Versions: 1

Compression:

Stored size: 1.87 KB

Contents

if Rails::VERSION::MAJOR > 4
  migration_class = ActiveRecord::Migration[4.2]
else
  migration_class = ActiveRecord::Migration
end

class CreateTables < migration_class
  def change
    create_table(:users) do |t|
      ## 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

      ## 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

      t.string :nick_name

      t.timestamps null: false
    end

    add_index :users, :email,                unique: true
    add_index :users, :reset_password_token, unique: true

    create_table(:admin_users) do |t|
      ## 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

      ## 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

      t.timestamps null: false
    end

    add_index :admin_users, :email,                unique: true
    add_index :admin_users, :reset_password_token, unique: true

    create_table :authentication_tokens do |t|
      t.string :body, null: false
      t.references :authenticatable, null: false, polymorphic: true
      t.datetime :last_used_at, null: false
      t.integer :expires_in, null: false, default: 0
      t.string :ip_address
      t.string :user_agent

      t.timestamps null: false
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tiddle-1.1.0 spec/rails_app/db/migrate/20150217000000_create_tables.rb