0.0.8 • Published 11 months ago
@vyce/migrate-state-store-mongodb v0.0.8
node-migrate-state-store-mongodb
This is a state storage implementation for the node-migrate
framework. It will store your migation state in a MongoDB collection called migrations
as separate documents.
Usage
- Install the package
$ npm install @vyce/migrate-state-store-mongodb
$ yarn add @vyce/migrate-state-store-mongodb
- Create a file to configure and expose the state storage
// state-store.ts
const { MongoStateStore } = require('@vyce/migrate-state-store-mongodb');
class StateStore extends MongoStateStore {
constructor() {
super({
uri: 'mongodb://localhost:27017',
collectionName: 'migrations',
});
}
};
module.exports = StateStore;
- Use the state storage in your migration scripts
// package.json
{
"scripts": {
"migrate:up": "migrate --store=\"./state-store.ts\" up",
"migrate:down": "migrate --store=\"./state-store.ts\" down",
}
}
Development
- Clone the repository
- Run
npm install
to install dependencies - Make changes, create new branch and commit & push
Releasing a new version
- Run
npm run version [patch|minor|major]
to bump the version - Commit and push changes
- Create pull request to master
- Merge PR to master and GitHub Action will build, publish and then tag the commit if successful