Sha256: 02e44d0cc486161785cda6d8a36a9b10b200679b4f29bb1d91853337e91ba919

Contents?: true

Size: 1.27 KB

Versions: 5

Compression:

Stored size: 1.27 KB

Contents

class AddDeviseTo<%= table_name.camelize %> < ActiveRecord::Migration
  def self.up
    change_table(:<%= table_name %>) do |t|
      t.database_authenticatable :null => false
      t.recoverable
      t.rememberable
      t.trackable
    
      # t.encryptable
      # t.confirmable
      # t.lockable :lock_strategy => :<%= Devise.lock_strategy %>, :unlock_strategy => :<%= Devise.unlock_strategy %>
      # t.token_authenticatable

<% for attribute in attributes -%>
      t.<%= attribute.type %> :<%= attribute.name %>
<% end -%>

      # Uncomment below if timestamps were not included in your original model.
      # t.timestamps
    end

    add_index :<%= table_name %>, :email,                :unique => true
    add_index :<%= table_name %>, :reset_password_token, :unique => true
    # add_index :<%= table_name %>, :confirmation_token,   :unique => true
    # add_index :<%= table_name %>, :unlock_token,         :unique => true
    # add_index :<%= table_name %>, :authentication_token, :unique => true
  end

  def self.down
    # By default, we don't want to make any assumption about how to roll back a migration when your
    # model already existed. Please edit below which fields you would like to remove in this migration.
    raise ActiveRecord::IrreversibleMigration   
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
devise-1.4.9 lib/generators/active_record/templates/migration_existing.rb
devise-1.4.8 lib/generators/active_record/templates/migration_existing.rb
devise-1.4.7 lib/generators/active_record/templates/migration_existing.rb
devise-1.4.5 lib/generators/active_record/templates/migration_existing.rb
devise-1.4.3 lib/generators/active_record/templates/migration_existing.rb