Registry / database / couchmigrate

couchmigrate

JSON →
library1.0.1jsnpmunverified

Couchmigrate is a command-line tool for migrating CouchDB design documents with zero downtime. Version 1.0.1 is the stable release. It compares the new design document against the existing one, and only migrates if there is a difference. The migration process copies the old document to _OLD, imports the new one as _NEW, triggers the view to build, polls until done, then renames _NEW to the original ID and deletes _OLD. Supports JSON files and JavaScript modules, and works with CouchDB and IBM Cloudant, including IAM authentication via environment variables.

npm install couchmigrate
INSTALL
IMPORT
SIG · COUCHMIGRATE
C
couchmigrate
databasejavascriptv1.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Run couchmigrate with a JSON design document file and target database.

couchmigrate --dd dd.json --db mydatabase
Debug
Known issues
gotchaThe design document file must have either .json or .js extension; otherwise, it will not be processed correctly.
fix
Use .json for JSON files or .js for JavaScript modules.
affects: >=1.0.0
gotchaThe tool relies on environment variables COUCH_URL and optionally IAM_API_KEY. If not set, it will fail with connection errors.
fix
Set COUCH_URL and IAM_API_KEY (if using IAM) before running.
affects: >=1.0.0
gotchaThe migration process creates temporary documents _OLD and _NEW, which may cause conflicts if other processes are modifying the same design document concurrently.
fix
Ensure no other process is modifying the design document during migration.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'nano'
Missing dependency nano
fix
Run `npm install -g couchmigrate` (installs nano as a dependency) or `npm install nano` in the project.
Error: COUCH_URL not set
Environment variable COUCH_URL is required
fix
Set the environment variable before running: export COUCH_URL=http://username:password@host:port or set it in your shell.
Error: Cannot read properties of undefined (reading 'map')
The JSON design document file might be malformed or missing the required structure
fix
Ensure the design document JSON includes _id and views fields correctly.
Error: ENOENT: no such file or directory, open 'dd.json'
The specified file path does not exist
fix
Provide the correct path to the design document file.
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies
nanorequiredCouchDB client library used for database operations
Agent activity
9 hits · last 30 days
node
8
OpenAI (training)
1
Resources
couchmigrate — npm install couchmigrate · libregistry