Created
March 15, 2009 02:14
-
-
Save jchris/79269 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'couchrest' | |
# this is the CouchDB where all the old databases are | |
OLD_HOST = "http://127.0.0.1:5984" | |
# this is the CouchDB we want to copy to | |
NEW_HOST = "http://127.0.0.1:5985" | |
old_couch = CouchRest.new(OLD_HOST) | |
new_couch = CouchRest.new(NEW_HOST) | |
databases = old_couch.databases | |
databases.each do |dbname| | |
if new_couch.databases.include?(dbname) | |
puts "the database '#{dbname}' already exists on the target" | |
puts "patches welcome for picking this process up in the middle" | |
puts "for now if it fails in the middle you could just comment out these lines" | |
puts "but you'll do double work and end up with spurious conflicts" | |
puts | |
puts | |
else | |
upgrader = CouchRest::Upgrade.new(dbname, old_couch, new_couch) | |
upgrader.clone! | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment