Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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
Something went wrong with that request. Please try again.