Created
August 9, 2010 14:11
-
-
Save zdzolton/515461 to your computer and use it in GitHub Desktop.
CouchDB - commit all databases
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
<!DOCTYPE html> | |
<html> | |
<head><title>Commit All Databases</title></head> | |
<body> | |
<h1>Commit All Databases</h1> | |
<p>This script will trigger <tt>_ensure_full_commit</tt> on all databases.</p> | |
<ul id="databases"></ul> | |
</body> | |
<script src="/_utils/script/jquery.js"></script> | |
<script src="/_utils/script/jquery.couch.js"></script> | |
<script> | |
$.couch.allDbs({ | |
success : function(dbs) { | |
dbs.forEach(function(db) { | |
$.ajax({ | |
type: "POST", url: "/" + encodeURIComponent(db) + "/_ensure_full_commit", | |
contentType: "application/json", dataType: "json", | |
complete : function(r) { | |
if (r.status == 201) { | |
$("#databases").append('<li>committed: '+db+'</li>'); | |
} else { | |
$("#databases").append('<li style="color:red;">error: '+db+'</li>'); | |
} | |
} | |
}); | |
}); | |
} | |
}); | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment