How to use the @mojaloop/central-services-database.Migrations function in @mojaloop/central-services-database

To help you get started, we’ve selected a few @mojaloop/central-services-database examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mojaloop / central-ledger / src / lib / migrator.js View on Github external
'use strict'

const Path = require('path')
const Migrations = require('@mojaloop/central-services-database').Migrations
const Knexfile = require('../../config/knexfile')

exports.migrate = function () {
  return Migrations.migrate(updateMigrationsLocation(Knexfile))
}

const updateMigrationsLocation = (kf) => {
  const parsedMigrationDir = Path.parse(kf.migrations.directory)
  kf.migrations.directory = Path.join(process.cwd(), parsedMigrationDir.base)
  const parsedSeedsDir = Path.parse(kf.seeds.directory)
  kf.seeds.directory = Path.join(process.cwd(), parsedSeedsDir.base)
  return kf
}