Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gobengo/node-migrate-mongodb-persistence
node-migrate plugin that persists migration state to MongoDB
https://github.com/gobengo/node-migrate-mongodb-persistence
Last synced: 25 days ago
JSON representation
node-migrate plugin that persists migration state to MongoDB
- Host: GitHub
- URL: https://github.com/gobengo/node-migrate-mongodb-persistence
- Owner: gobengo
- License: mit
- Created: 2015-01-07T19:51:24.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-01-07T19:52:34.000Z (almost 10 years ago)
- Last Synced: 2024-10-03T15:30:04.615Z (about 1 month ago)
- Language: JavaScript
- Size: 129 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# migrate-mongodb-persistence
Mixin for [`node-migrate`](https://npm.im/migrate) CLI that will persist current migration state to a MongoDB collection instead of a flat file.
This is useful when you have several transient application servers (and filesystems) sharing a single database. You only need to migrate once per database; not once per filesystem.
This makes `migrate` behave more like [Django South](https://south.readthedocs.org) or [Ruby on Rails ActiveRecord Migrations](http://edgeguides.rubyonrails.org/active_record_migrations.html).
## Usage
1. Make sure you're using a branch of migrate that supports mixins. `npm install --save-dev git://github.com/gobengo/node-migrate#012015_mixins`.
2. Create a new module like `tools/store-migration-state-in-mongo.js`. Something like:```javascript
var mongoDbConnectionString = 'localhost'; // or get from your config file
var migrationStateCollectionName = 'migration_state'; // or whatevermodule.exports = require('migrate-mongo-persistence')(
mongoDbConnectionString, migrationStateCollectionName);
```3. When running the migrate cli, use your mixin like `./node_modules/.bin/migrate --use tools/store-migration-state-in-mongo.js `