Skip to content

Instantly share code, notes, and snippets.

@timh
Created December 3, 2009 21:28
Show Gist options
  • Save timh/248544 to your computer and use it in GitHub Desktop.
Save timh/248544 to your computer and use it in GitHub Desktop.
timmbp-oc:~/devel/opscode tim$ cat couchdb-delete-dbs.rb
#!/usr/bin/env ruby
require 'rubygems'
require 'couchrest'
class CouchDbDeleter
def initialize()
@couch_client = CouchRest.new('http://localhost:5984')
end
def go()
all_db_names = @couch_client.databases
all_db_names.each do |db_name|
if db_name =~ /authorization_design_documents/
puts "NOT DELETING #{db_name}"
else
puts "!!! DELETING #{db_name}"
db = @couch_client.database(db_name)
db.delete!
end
end
end
end
db = CouchDbDeleter.new
db.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment