Sha256: a356b968ad42d1fc11c4829d9f0e4398925e42e41a01bf3da84e11de5a786a07

Contents?: true

Size: 967 Bytes

Versions: 12

Compression:

Stored size: 967 Bytes

Contents

class AddDeviseTo<%= table_name.camelize %> < ActiveRecord::Migration<%= migration_version %>
  def self.up
    change_table :<%= table_name %> do |t|
<%= migration_data -%>

<% attributes.each do |attribute| -%>
      t.<%= attribute.type %> :<%= attribute.name %>
<% end -%>

      # Uncomment below if timestamps were not included in your original model.
      # t.timestamps null: false
    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
  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

12 entries across 12 versions & 3 rubygems

Version Path
devise-4.3.0 lib/generators/active_record/templates/migration_existing.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/devise-4.2.1/lib/generators/active_record/templates/migration_existing.rb
devise-4.2.1 lib/generators/active_record/templates/migration_existing.rb
devise-4.2.0 lib/generators/active_record/templates/migration_existing.rb
devise-4.0.3 lib/generators/active_record/templates/migration_existing.rb
devise-4.1.1 lib/generators/active_record/templates/migration_existing.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/devise-4.1.0/lib/generators/active_record/templates/migration_existing.rb
devise-4.1.0 lib/generators/active_record/templates/migration_existing.rb
devise-4.0.2 lib/generators/active_record/templates/migration_existing.rb
devise-4.0.1 lib/generators/active_record/templates/migration_existing.rb
devise-4.0.0 lib/generators/active_record/templates/migration_existing.rb
devise-4.0.0.rc2 lib/generators/active_record/templates/migration_existing.rb