Ektorp is a node.js library and command-line utility for building your CouchDB.
Ektorp is incomplete, and is in a "stabilized state of decay". Mostly, this means that you should fork this project and enhance it for your own needs. I don't have any plans to enhance it, going forward. :-)
-
Install ektorp globally:
$ npm install -g ektorp
-
Run ektorp:
$ ektorp http://localhost:5984/new_db ./migrations
-
Relax!
To integrate ektorp and control more aspects of the migration:
-
Install ektorp (doesn't need to be installed globally if you don't want to use the CLI tool):
$ npm install ektorp
-
Leverage ektorp in your own bootstrap script:
var ektorp = require('ektorp'); //pass the url to the DB you want to upgrade, and the path to migrations: var migrator = ektorp('http://localhost:5984/new_db', './migrations'); migrator.on('done', function(){ console.log('Migrations are done!'); }); //cause the migrator to start. migrator.start();
Here's one way that is supported (there are others that will be documented soon):
-
Create a directory:
$ mkdir ./migrations
-
Make a migration:
$ cd ./migrations $ touch 201401310849_first_migration.json
-
You can put a JSON array or object in
201401310849_first_migration.json
, it will be pushed to the database when you runektorp
.