exframe-seeding

2.0.3 • Public • Published

Exframe Seeding

A module for seeding the master data for the micro services.

Prerequisites

Node and npm should be available.

Usage

  • Install exframe-seeding module in your micro service.
npm install exframe-seeding --save
  • Create a folder for your DB scripts and specify it in the environment variable DB_SCRIPTS_PATH(relative path from the root folder for your application). The module looks for a folder db_scripts in the root folder of your micro service by default.

  • The module reads the files in the specified folder sequentially and executes the up method in them. The template for a DB script file is:

const model = require('Schema path');

module.exports = {
  up: () => {
    return new Promise((resolve, reject) => {
      // Modifications in your DB with the provided instance of model
    });
  }
}
  • The micro service has to be started with npm, as the package gets the fetches the name of the micro service from db_scripts folder of the respective service name.

  • In order to downgrade, you just need to run the command exframe-downgrade from an npm script in order for the package to fetch the name of the micro service. This command expects MONGO_URL and DB_SCRIPTS_PATH to be present in the environment variables.

Readme

Keywords

none

Package Sidebar

Install

npm i exframe-seeding

Weekly Downloads

3

Version

2.0.3

License

ISC

Unpacked Size

19.7 kB

Total Files

11

Last publish

Collaborators

  • exzeo_usa