end def self.retrieve_connection connection_handler.retrieve_connection(proxy_connection) end yield ensure self.proxy_connection = nil def self.connection_pool connection_handler.retrieve_connection_pool(self) end def self.retrieve_connection connection_handler.retrieve_connection(self) end end
database" task :migrate => :environment do verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true version = ENV["VERSION"] ? ENV["VERSION"].to_i : nil ActiveRecord::Migration.verbose = verbose Customer.find_each do |customer| puts "migrating customer #{customer.domain}" if verbose customer.using_connection do ActiveRecord::Migrator.migrate(ActiveRecord::Migrator.migrations_paths, version) end end end end