2.0.3 • Published 5 years ago

exframe-seeding v2.0.3

Weekly downloads
3
License
ISC
Repository
-
Last release
5 years ago

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.

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago