How to use the migrate.load function in migrate

To help you get started, we’ve selected a few migrate 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 dmanjunath / node-redshift / lib / migration.js View on Github external
function performMigration(direction, migrationName) {
  var state = join(folderName, '.migrate');
  var set = migrate.load(state, folderName);

  set.on('migration', function (migration, direction) {
    console.log(direction, migration.title);
  });

  var migrationPath = migrationName ?
    join(folderName, migrationName) :
    migrationName;

  set[direction](migrationName, function (err) {
    if (err) {
      console.log('error', err);
      process.exit(1);
    }

    console.log('migration', 'complete');
github OpenCTI-Platform / opencti / opencti-graphql / src / database / migration.js View on Github external
await write(
      `insert $x isa MigrationReference,
      has internal_id "${uuid()}",
      has title "${mig.title}",
      has timestamp ${mig.timestamp};`
    );
    await write(
      `match $status isa MigrationStatus; 
      $ref isa MigrationReference, has title "${mig.title}"; 
      insert (status: $status, state: $ref) isa migrate, has internal_id "${uuid()}";`
    );
    fn();
  }
};

migrate.load({ stateStore: graknStateStorage }, (err, set) => {
  if (err) {
    throw err;
  }
  logger.info('Migration state successfully updated, starting migrations');
  set.up(err2 => {
    if (err2) {
      throw err2;
    }
    logger.info('Migrations successfully ran');
    process.exit(0);
  });
});
github OpenCTI-Platform / opencti / opencti-platform / opencti-graphql / src / database / migration.js View on Github external
return new Promise((resolve, reject) => {
    const migrationsDirectory = path.join(__dirname, '../migrations');
    return migrate.load({ stateStore: graknStateStorage, migrationsDirectory }, async (err, set) => {
      if (err) reject(err);
      logger.info('[MIGRATION] > Migration state successfully updated, starting migrations');
      return set.up(err2 => {
        if (err2) reject(err2);
        logger.info('[MIGRATION] > Migrations successfully ran');
        resolve(true);
      });
    });
  });
};

migrate

Abstract migration framework for node

MIT
Latest version published 3 months ago

Package Health Score

75 / 100
Full package analysis