db-migrate 1.0.0-beta.30 → 1.0.0-beta.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/api.js CHANGED
@@ -50,7 +50,7 @@ function dbmigrate (plugins, isModule, options, callback) {
50
50
  if (config.dotenvCustomPath) {
51
51
  dotenvConfig.path = config.dotenvCustomPath;
52
52
  }
53
- dotenv.load(dotenvConfig);
53
+ dotenv.config(dotenvConfig);
54
54
 
55
55
  /* $lab:coverage:off$ */
56
56
  if (!options || !options.throwUncatched) load('helper/register-events')();
@@ -58,7 +58,7 @@ const execUnit = {
58
58
  'An error occured. No alternative failure strategy defined. Rolling back!',
59
59
  err
60
60
  );
61
- await execUnit.down(context, driver, file);
61
+ await execUnit.down(context, driver, file, { abort: true });
62
62
  throw err;
63
63
  }
64
64
  await Promise.promisify(context.writeMigrationRecord.bind(context))(file);
@@ -104,9 +104,13 @@ const execUnit = {
104
104
  // end migration, same as start migration
105
105
  },
106
106
 
107
- down: async function (context, driver, file) {
107
+ down: async function (context, driver, file, { abort } = {}) {
108
+ // if we get the abort signal this means we are in a rollback routine
109
+ // which means in turn we want to avoid reloading the state
110
+ if (abort === true) {
111
+ await State.startMigration(context._pdriver, file, context.internals);
112
+ }
108
113
  // start migration, see up comments
109
- await State.startMigration(context._pdriver, file, context.internals);
110
114
  await TranslateState(context._driver, file, driver, context.internals, context._pdriver);
111
115
  await State.endMigration(context._pdriver, file, context.internals);
112
116
  return Promise.promisify(context.deleteMigrationRecord.bind(context))(file);
package/package.json CHANGED
@@ -31,7 +31,7 @@
31
31
  "programable",
32
32
  "api"
33
33
  ],
34
- "version": "1.0.0-beta.30",
34
+ "version": "1.0.0-beta.32",
35
35
  "engines": {
36
36
  "node": ">=8.0.0"
37
37
  },