Skip to content

a collection of the code we use for data migrations on Couch databases. hopefully we will extract some pattern out of this

License

Notifications You must be signed in to change notification settings

eHealthAfrica/eha-couch-migrations

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eHealth Africa Couch Migrations

A collection of the code we use for data migrations on Couch databases. Hopefully we will extract some pattern out of this.

The rationale behind the creation of this repo, and links to other similar repos internal to eHealth are on this private issue

migration mechanisms

We define a migration mechanism or migrator as a service that connects to a couchdb database and performs a change in a document.

Current migrators are:

  • pouchdb-migrate
  • view-update (to be included)

Different migrators serve different situations. The following table sums up the space:

migrator migration speed data size conflicts possiblity
pouchdb-migrate fast small high
view + update function slow big low
nano script example call center migrations fast ? ?

migrations

Migrations are included their own folder with a descriptive name of what it does; it contains:

  • a migration file named migration.js
  • a README.md for documentation and references of the migration.

migration management

This has been raised on (this issue)[#5] and here https://github.com/eHealthAfrica/model-discussion/issues/4

Installation

get the repo

git clone git@github.com:eHealthAfrica/eha-couch-migrations.git
cd eha-couch-migrations

and run npm install

Usage

in this example we'll run the pouchdb-migrate migrator against db, using the deduplicate-source-cases migration.

bin/main.js 'pouchdb-migrate' 'http://user:password@localhost:5984/test' deduplicate-source-cases

db is any db format accepted by PouchDB

Docker Usage

There is a docker image for the call center migrations case, name docker-registry.eocng.org/ehealthafrica/call_center_migrator with tag depending on the used branch. The repo is here.

Development

Run the tests from project root with:

npm test

License

Copyright 2015 eHealth Africa

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License here.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Apache License 2.0

About

a collection of the code we use for data migrations on Couch databases. hopefully we will extract some pattern out of this

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published