deploy_couch

deploy_couch is db deploy tool for couchdb.

How to install

gem install deploy_couch

Usage

deploy_couch ‘path/to/couchdb.yml’ [rollback:(1|2|3|..|all)]

rollback:all

rollbacks all the deltas

Example

deploy_couch/spec/couchdb.yml for couchdb.yml config file deploy_couch/spec/integration/deltas for delta files

Config Parameters

hostname: <couchdb database server hostname> port: <couchdb server port number , by default 5984> delta_path: < path/to/deltas folder relative to configdb.yml> database: <couchdb database name> doc_type_field: <field name used to identify the document type> type_version_field: <deploy_couch uses this field to maintain type version of the document, you can configure the field name>

Delta File name format

<Delta Number>_<Description>.yml example 1_add_address_to_customer.yml

Delta File content format

type: < document type, example: customer > map_function: <map function used to modify customer document. return value ‘update’ indicates updating the document with changes>

function map(doc)
{
    doc.address = "some address";
    return 'update';
}

rollback_function: <rollback function used when rolling back applied delta.>

function map(doc)
{
    delete doc.address;
    return 'update';
}