# Uninstall hook code here require File.join(File.dirname(__FILE__), "..", "..", "..", "config", "environment") db_path = File.join(File.dirname(__FILE__), "..", "..", "..", "db", "migrate", "") puts if ActiveRecord::Migrator.using_duplicate_migrations? if !ActiveRecord::Migrator.using_non_duplicate_migrations? puts "Creating a new schema_info table and inserting default data according to existing schema_infos." ActiveRecord::Migrator.convert_from_duplicates(db_path) puts "Success! You should be able to delete the schema_infos table using the following task:" puts " rake db:cleanup:delete_duplicates" else puts "Not converting exsiting schema_infos into schema_info, because schema_info table unexpectedly exists." puts "It's likely duplicate migrations has already been uninstalled at some point." puts "It's also possible that traditional migrations have been run in the past and the table hasn't been cleaned up." puts "If you want to overwrite schema_info with the version number computed from schema_infos, run the following rake task:" puts " rake db:convert:disallow_duplicates" end else if ActiveRecord::Migrator.using_non_duplicate_migrations? puts "Not converting existing schema_infos, because no schema_infos table present.\nDuplicate migrations have already been uninstalled." else puts "Not converting existing schema_infos, because no schema_infos table present.\nRake db:migrate has probably not been run yet." end end puts