<commit_before>'use strict';

var _ = require('lodash');
var path = require('path');
var chalk = require('chalk');
var env = process.env.NODE_ENV || 'development';
var Database = require('../db/database');

module.exports.migrate = function(azulfile, options) {
  var db = Database.create(azulfile[env]);
  var migrator = db.migrator(path.resolve(options.migrations));

  return migrator.migrate()
  .then(function(migrations) {
    var batches = _(migrations).pluck('batch').unique().value().join(', ');
    console.log(chalk.magenta('Applying migrations, batch %s'), batches);
    migrations.forEach(function(migration) {
      console.log(chalk.cyan('%s'), migration.name);
    });
  })
  .catch(function(e) {
    console.log(chalk.red('Migration failed. %s'), e);
    process.exit(1);
  })
  .finally(function() { db.disconnect(); });
};

module.exports.rollback = function(azulfile, options) {
  var db = Database.create(azulfile[env]);
  var migrator = db.migrator(path.resolve(options.migrations));

  return migrator.rollback()
  .then(function(migrations) {
    var batches = _(migrations).pluck('batch').unique().value().join(', ');
    console.log(chalk.magenta('Rolling back migrations, batch %s'), batches);
    migrations.forEach(function(migration) {
      console.log(chalk.cyan('%s'), migration.name);
    });
  })
  .catch(function(e) {
    console.log(chalk.red('Rollback failed. %s'), e);
    process.exit(1);
  })
  .finally(function() { db.disconnect(); });
};<commit_msg>Added environment to migration output.<commit_after>'use strict';

var _ = require('lodash');
var path = require('path');
var chalk = require('chalk');
var env = process.env.NODE_ENV || 'development';
var Database = require('../db/database');

module.exports.migrate = function(azulfile, options) {
  var db = Database.create(azulfile[env]);
  var migrator = db.migrator(path.resolve(options.migrations));

  return migrator.migrate()
  .then(function(migrations) {
    var batches = _(migrations).pluck('batch').unique().value().join(', ');
    console.log(chalk.magenta('Applying migrations, ' +
      '%s environment, batch %s'), env, batches);
    migrations.forEach(function(migration) {
      console.log(chalk.cyan('%s'), migration.name);
    });
  })
  .catch(function(e) {
    console.log(chalk.red('Migration failed. %s'), e);
    process.exit(1);
  })
  .finally(function() { db.disconnect(); });
};

module.exports.rollback = function(azulfile, options) {
  var db = Database.create(azulfile[env]);
  var migrator = db.migrator(path.resolve(options.migrations));

  return migrator.rollback()
  .then(function(migrations) {
    var batches = _(migrations).pluck('batch').unique().value().join(', ');
    console.log(chalk.magenta('Rolling back migrations, ' +
      '%s environment, batch %s'), env, batches);
    migrations.forEach(function(migration) {
      console.log(chalk.cyan('%s'), migration.name);
    });
  })
  .catch(function(e) {
    console.log(chalk.red('Rollback failed. %s'), e);
    process.exit(1);
  })
  .finally(function() { db.disconnect(); });
};
{'fraction_non_alphanumeric': 0.19142021449463764, 'fraction_numerical': 0.0012999675008124798, 'mean_word_length': 4.438162544169611, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '66907', 'n_tokens_mistral': 1023, 'n_tokens_neox': 1044, 'n_words': 170}