gregbell/active_admin — Issue #1030: Adds a new devise migration when there is an existing one
Author: brunomac
Created: 2012-02-16 16:05:36+00:00
State: open

I already add a devise migration for admin_users but the generator active_admin:install installed a duplicated one.

invoke devise
generate No need to install devise, already done.
invoke active_record
create db/migrate/20120216154213_add_devise_to_admin_users.rb
insert app/models/admin_user.rb
route devise_for :admin_users
gsub app/models/admin_user.rb
gsub config/routes.rb
insert db/migrate/20120106104412_devise_create_admin_users.rb
create config/initializers/active_admin.rb
create app/admin
create app/admin/dashboards.rb
route ActiveAdmin.routes(self)
generate active_admin:assets
create app/assets/javascripts/active_admin.js
create app/assets/stylesheets/active_admin.css.scss
create db/migrate/20120216074241_create_admin_notes.rb
create db/migrate/20120216074242_move_admin_notes_to_comments.rb

existing migration:

class DeviseCreateAdminUsers < ActiveRecord::Migration
def change
create_table(:admin_users) do |t|
t.database_authenticatable :null => false
t.recoverable
t.rememberable
t.trackable

# t.encryptable
# t.confirmable
t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both
# t.token_authenticatable

t.timestamps
end

# Create a default user
AdminUser.create!(:email => 'admin@example.com', :password => 'password', :password_confirmation => 'password')

add_index :admin_users, :email, :unique => true
add_index :admin_users, :reset_password_token, :unique => true
# add_index :admins, :confirmation_token, :unique => true
# add_index :admins, :unlock_token, :unique => true
# add_index :admins, :authentication_token, :unique => true
end

end

new/created migration by installer

class AddDeviseToAdminUsers < ActiveRecord::Migration
def self.up
change_table(:admin_users) do |t|
t.database_authenticatable :null => false
t.recoverable
t.rememberable
t.trackable

# t.encryptable
# t.confirmable
# t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :email
# t.token_authenticatable

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

add_index :admin_users, :email, :unique => true
add_index :admin_users, :reset_password_token, :unique => true
# add_index :admin_users, :confirmation_token, :unique => true
# add_index :admin_users, :unlock_token, :unique => true
# add_index :admin_users, :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