Add support for database compaction.
This commit is contained in:
parent
12c09085df
commit
dd7f109878
|
@ -150,6 +150,11 @@ module CouchRest
|
||||||
CouchRest.delete "#{@root}/#{slug}?rev=#{doc['_rev']}"
|
CouchRest.delete "#{@root}/#{slug}?rev=#{doc['_rev']}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Compact the database, removing old document revisions and optimizing space use.
|
||||||
|
def compact!
|
||||||
|
CouchRest.post "#{@root}/_compact"
|
||||||
|
end
|
||||||
|
|
||||||
# DELETE the database itself. This is not undoable and could be rather
|
# DELETE the database itself. This is not undoable and could be rather
|
||||||
# catastrophic. Use with care!
|
# catastrophic. Use with care!
|
||||||
def delete!
|
def delete!
|
||||||
|
|
|
@ -461,6 +461,16 @@ describe CouchRest::Database do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
describe "compacting a database" do
|
||||||
|
it "should compact the database" do
|
||||||
|
db = @cr.database('couchrest-test')
|
||||||
|
# r =
|
||||||
|
db.compact!
|
||||||
|
# r['ok'].should == true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "deleting a database" do
|
describe "deleting a database" do
|
||||||
it "should start with the test database" do
|
it "should start with the test database" do
|
||||||
@cr.databases.should include('couchrest-test')
|
@cr.databases.should include('couchrest-test')
|
||||||
|
|
Loading…
Reference in a new issue