Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eHealthAfrica/pouchdb-migrate
PouchDB plugin for running migrations.
https://github.com/eHealthAfrica/pouchdb-migrate
Last synced: 5 days ago
JSON representation
PouchDB plugin for running migrations.
- Host: GitHub
- URL: https://github.com/eHealthAfrica/pouchdb-migrate
- Owner: eHealthAfrica
- License: other
- Created: 2015-05-04T15:01:34.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-02-11T08:36:30.000Z (over 6 years ago)
- Last Synced: 2024-10-04T17:09:00.109Z (about 1 month ago)
- Language: JavaScript
- Size: 74.2 KB
- Stars: 62
- Watchers: 55
- Forks: 12
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-starred - eHealthAfrica/pouchdb-migrate - PouchDB plugin for running migrations. (others)
README
# pouchdb-migrate
PouchDB plugin for running migrations.[![Build
Status](https://travis-ci.org/eHealthAfrica/pouchdb-migrate.svg?branch=master)](https://travis-ci.org/eHealthAfrica/pouchdb-migrate)## Setup
```html```
Or to use it in Node.js, just npm install it:
```
npm install pouchdb-migrate
```And then attach it to the `PouchDB` object:
```js
var PouchDB = require('pouchdb');
PouchDB.plugin(require('pouchdb-migrate'));
```## Usage
```js
var db = new PouchDB('mydb')// Migration script
// * Return falsy value to skip the doc
// * Make sure to prevent from loops
var migration = function(doc) {
if ('foo' in doc) returndoc.foo = 'bar'
return [doc]
}db.migrate(migration)
.then //... every doc has `foo` now
```## Testing
Run the tests with
```sh
npm test
```