db-migrate 1.0.0-beta.9 → 1.0.0-rc.0

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/LICENSE CHANGED
@@ -20,3 +20,29 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
20
  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
21
  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
22
  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+ AI OSS License
25
+
26
+ Copyright (c) 2015 db-migrate
27
+
28
+ Permission is hereby granted, free of charge, to any person obtaining a copy
29
+ of this software and associated documentation files (the "Software"), to deal
30
+ in the Software without restriction, including without limitation the rights
31
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
32
+ copies of the Software, and to permit persons to whom the Software is
33
+ furnished to do so, subject to the following conditions:
34
+
35
+ The above copyright notice and this permission notice shall be included in all
36
+ copies or substantial portions of the Software, as well as in results by
37
+ AI models, which result from the source code this License applies to.
38
+ The source code is not allowed to be used for training except for
39
+ models that itself are open source.
40
+
41
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
42
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
43
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
44
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
45
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
46
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
47
+ SOFTWARE.
48
+
package/README.md CHANGED
@@ -1,10 +1,6 @@
1
1
  [![Backers on Open Collective](https://opencollective.com/node-db-migrate/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/node-db-migrate/sponsors/badge.svg)](#sponsors)
2
- [![Build Status](https://travis-ci.org/db-migrate/node-db-migrate.svg?branch=master)](https://travis-ci.org/db-migrate/node-db-migrate)
3
- [![Dependency Status](https://david-dm.org/db-migrate/node-db-migrate.svg)](https://david-dm.org/db-migrate/node-db-migrate)
4
- [![devDependency Status](https://david-dm.org/db-migrate/node-db-migrate/dev-status.svg)](https://david-dm.org/db-migrate/node-db-migrate#info=devDependencies)
2
+ [![Build Status](https://github.com/db-migrate/node-db-migrate/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/db-migrate/node-db-migrate/actions/workflows/ci.yml)
5
3
  [![Documentation Status](https://readthedocs.org/projects/db-migrate/badge/?version=latest)](https://readthedocs.org/projects/db-migrate/?badge=latest)
6
- [![Code Quality: Javascript](https://img.shields.io/lgtm/grade/javascript/g/db-migrate/node-db-migrate.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/db-migrate/node-db-migrate/context:javascript)
7
- [![Total Alerts](https://img.shields.io/lgtm/alerts/g/db-migrate/node-db-migrate.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/db-migrate/node-db-migrate/alerts)
8
4
 
9
5
  # db-migrate
10
6
 
@@ -24,6 +20,11 @@ Support this project by becoming a sponsor. Your logo will show up here with a l
24
20
 
25
21
  # Usage
26
22
 
23
+ ## Requirements
24
+
25
+ Officially supported is Node.js 24 and newer. Older versions may work, but
26
+ are not tested.
27
+
27
28
  ## Installation
28
29
 
29
30
  $ npm install -g db-migrate
@@ -53,6 +54,13 @@ DB-Migrate is now available to you via:
53
54
  - Mongodb (https://github.com/mongodb/node-mongodb-native)
54
55
  https://github.com/db-migrate/mongodb
55
56
 
57
+ ## Connecting through an SSH tunnel
58
+
59
+ Tunnels are provided by plugins. Install the ssh tunnel plugin next to
60
+ db-migrate to use the `tunnel` setting of your database config:
61
+
62
+ $ npm install db-migrate-plugin-tunnel-ssh
63
+
56
64
  ## Resources and usage instructions
57
65
 
58
66
  Please follow the link below, for usage instructions examples and the full
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')();
@@ -105,7 +105,7 @@ function dbmigrate (plugins, isModule, options, callback) {
105
105
  dbmigrate.prototype = {
106
106
  /**
107
107
  * Add a global defined variable to db-migrate, to enable access from
108
- * local migrations without configuring pathes.
108
+ * local migrations without configuring paths.
109
109
  *
110
110
  * @return boolean
111
111
  */
@@ -245,6 +245,31 @@ dbmigrate.prototype = {
245
245
  );
246
246
  },
247
247
 
248
+ fix: function (specification, opts, callback) {
249
+ var executeFix = load('fix');
250
+
251
+ if (arguments.length > 0) {
252
+ if (typeof specification === 'string') {
253
+ this.internals.argv.destination = specification;
254
+ } else if (typeof specification === 'number') {
255
+ this.internals.argv.count = specification;
256
+ } else if (typeof specification === 'function') {
257
+ callback = specification;
258
+ }
259
+
260
+ if (typeof opts === 'string') {
261
+ this.internals.migrationMode = opts;
262
+ this.internals.matching = opts;
263
+ } else if (typeof opts === 'function') {
264
+ callback = opts;
265
+ }
266
+ }
267
+
268
+ return Promise.resolve(executeFix(this.internals, this.config)).nodeify(
269
+ callback
270
+ );
271
+ },
272
+
248
273
  check: function (specification, opts, callback) {
249
274
  var executeCheck = load('check');
250
275
 
package/connect.js CHANGED
@@ -9,7 +9,9 @@ var path = require('path');
9
9
  var log = require('db-migrate-shared').log;
10
10
  const Promise = require('bluebird');
11
11
 
12
- exports.connect = function (config, PassedClass) {
12
+ Promise.promisifyAll(driver);
13
+
14
+ exports.connect = async function (config, PassedClass) {
13
15
  var internals = {};
14
16
  var prefix = 'migration';
15
17
  if (config.config) {
@@ -18,6 +20,8 @@ exports.connect = function (config, PassedClass) {
18
20
  config = config.config;
19
21
  }
20
22
 
23
+ const db2 = await driver.connectAsync(config, internals);
24
+
21
25
  return Promise.fromCallback(callback => {
22
26
  driver.connect(config, internals, function (err, db) {
23
27
  if (err) {
@@ -25,10 +29,18 @@ exports.connect = function (config, PassedClass) {
25
29
  return;
26
30
  }
27
31
 
32
+ const realClose = db.close;
33
+ // close both lines with one disconnect action
34
+ db.close = function (cb) {
35
+ db2.close(function () {});
36
+ db.close = realClose;
37
+ db.close(cb);
38
+ };
39
+
40
+ var dirPath = path.resolve(
41
+ internals.argv['migrations-dir'] || 'migrations'
42
+ );
28
43
  if (internals.migrationMode) {
29
- var dirPath = path.resolve(
30
- internals.argv['migrations-dir'] || 'migrations'
31
- );
32
44
  if (internals.migrationMode !== 'all') {
33
45
  var switched = false;
34
46
  var newConf;
@@ -56,10 +68,11 @@ exports.connect = function (config, PassedClass) {
56
68
  null,
57
69
  new PassedClass(
58
70
  db,
59
- internals.argv['migrations-dir'],
71
+ dirPath,
60
72
  internals.mode !== 'static',
61
73
  internals,
62
- prefix
74
+ prefix,
75
+ { db2 }
63
76
  )
64
77
  );
65
78
  });
@@ -69,10 +82,11 @@ exports.connect = function (config, PassedClass) {
69
82
  null,
70
83
  new PassedClass(
71
84
  db,
72
- internals.argv['migrations-dir'],
85
+ dirPath,
73
86
  internals.mode !== 'static',
74
87
  internals,
75
- prefix
88
+ prefix,
89
+ { db2 }
76
90
  )
77
91
  );
78
92
  }
@@ -100,6 +114,7 @@ exports.connect = function (config, PassedClass) {
100
114
  db,
101
115
  oldClose,
102
116
  prefix,
117
+ db2,
103
118
  cb
104
119
  );
105
120
  };
@@ -112,10 +127,11 @@ exports.connect = function (config, PassedClass) {
112
127
  null,
113
128
  new PassedClass(
114
129
  db,
115
- internals.argv['migrations-dir'],
130
+ dirPath,
116
131
  internals.mode !== 'static',
117
132
  internals,
118
- prefix
133
+ prefix,
134
+ { db2 }
119
135
  )
120
136
  );
121
137
  }
@@ -142,6 +158,7 @@ function migrationFiles (
142
158
  db,
143
159
  close,
144
160
  prefix,
161
+ db2,
145
162
  cb
146
163
  ) {
147
164
  var file;
@@ -187,7 +204,8 @@ function migrationFiles (
187
204
  internals.argv['migrations-dir'],
188
205
  internals.mode !== 'static',
189
206
  internals,
190
- prefix
207
+ prefix,
208
+ { db2 }
191
209
  )
192
210
  );
193
211
 
package/lib/chain.js CHANGED
@@ -1,3 +1,5 @@
1
+ const log = require('db-migrate-shared').log;
2
+
1
3
  const DEFAULT = [
2
4
  'renameCollection',
3
5
  'dropCollection',
@@ -15,6 +17,21 @@ const DEFAULT = [
15
17
  'removeForeignKey'
16
18
  ];
17
19
 
20
+ /**
21
+ * Human readable form of an instruction for the log, like
22
+ * addColumn("users", "email")
23
+ */
24
+ const describe = (method, args) =>
25
+ `${method}(${args
26
+ .filter(
27
+ a =>
28
+ typeof a === 'string' ||
29
+ typeof a === 'number' ||
30
+ (Array.isArray(a) && a.every(x => typeof x === 'string'))
31
+ )
32
+ .map(a => JSON.stringify(a))
33
+ .join(', ')})`;
34
+
18
35
  let rollbackCounter = 0;
19
36
  let rollbackSignal = null;
20
37
  let signal = null;
@@ -55,10 +72,11 @@ const dbmControl = {
55
72
  };
56
73
 
57
74
  class Chain {
58
- constructor (context, file, driver, internals) {
75
+ constructor (context, file, driver, internals, pdriver) {
59
76
  this.file = file;
60
77
  this.context = context;
61
78
  this.driver = context;
79
+ this.pdriver = pdriver;
62
80
  this.udriver = driver;
63
81
  if (this.udriver._dbmControl !== true) {
64
82
  this.udriver._counter = dbmControl;
@@ -81,6 +99,14 @@ class Chain {
81
99
  this._step = null;
82
100
  this._interface = null;
83
101
 
102
+ /**
103
+ * op: number of the current step, the instructions of a migration
104
+ * recovery: progress of an interrupted previous run to resume from,
105
+ * see State.startMigration
106
+ */
107
+ this.op = 0;
108
+ this.recovery = null;
109
+
84
110
  DEFAULT.concat(Object.keys(this.context.learnable || [])).forEach(
85
111
  method => {
86
112
  this[method] = function (...args) {
@@ -113,7 +139,8 @@ class Chain {
113
139
  this.context,
114
140
  this.file,
115
141
  this.udriver,
116
- this.internals
142
+ this.internals,
143
+ this.pdriver
117
144
  );
118
145
  }
119
146
 
@@ -128,7 +155,34 @@ class Chain {
128
155
  async exec (m, ...args) {
129
156
  let ret;
130
157
  const stat = [];
158
+ const op = ++this.op;
159
+ const recovery = this.recovery;
160
+ this.internals.migrationOp = op;
161
+ this.current = describe(m, args);
162
+
163
+ if (recovery && op <= recovery.done) {
164
+ log.info(
165
+ `[recovery] ${this.file.name}: skipping already executed step ` +
166
+ `${op}/${recovery.done} ${describe(m, args)}`
167
+ );
168
+ return ret;
169
+ }
170
+
171
+ // the step was interrupted after its reverse operation was recorded,
172
+ // but before it finished on the database
173
+ const learned = recovery !== null && op <= recovery.learned;
174
+ if (learned) {
175
+ log.info(
176
+ `[recovery] ${this.file.name}: executing interrupted step ${op} ` +
177
+ `${describe(m, args)} without learning it again`
178
+ );
179
+ }
180
+
131
181
  while (this.step()) {
182
+ if (learned && this._step.learns) {
183
+ continue;
184
+ }
185
+
132
186
  ret = await this._interface[m].apply(this._interface, args);
133
187
  stat.push(ret);
134
188
 
@@ -136,6 +190,7 @@ class Chain {
136
190
  this._step.useState(ret);
137
191
  }
138
192
 
193
+ // need to check if we still want this
139
194
  if (this._step.hasModification) {
140
195
  const ret = this._step.modify(
141
196
  this.context,
@@ -21,15 +21,15 @@ async function prepare (internals, config) {
21
21
  );
22
22
 
23
23
  if (internals.locTitle) {
24
- migrator.migrationsDir = path.resolve(
24
+ migrator.directory = path.resolve(
25
25
  internals.argv['migrations-dir'],
26
26
  internals.locTitle
27
27
  );
28
28
  } else {
29
- migrator.migrationsDir = path.resolve(internals.argv['migrations-dir']);
29
+ migrator.directory = path.resolve(internals.argv['migrations-dir']);
30
30
  }
31
31
 
32
- internals.migrationsDir = migrator.migrationsDir;
32
+ internals.migrationsDir = migrator.directory;
33
33
 
34
34
  await migrator.createMigrationsTable();
35
35
  log.verbose('migration table created');
@@ -2,21 +2,40 @@
2
2
 
3
3
  const Promise = require('bluebird');
4
4
  const log = require('db-migrate-shared').log;
5
- const mkdirp = Promise.promisify(require('mkdirp'));
6
5
  const fs = require('fs');
7
6
  const stat = Promise.promisify(fs.stat);
7
+ const writeFile = Promise.promisify(fs.writeFile);
8
8
  const yargs = require('yargs');
9
9
  const util = require('util');
10
+ const path = require('path');
10
11
 
11
12
  async function createMigrationDir (dir) {
12
13
  const res = await stat(dir).catch(_ => {
13
14
  return { err: true };
14
15
  });
15
16
  if (res && res.err === true) {
16
- return mkdirp(dir);
17
+ await fs.promises.mkdir(dir, { recursive: true });
17
18
  }
18
19
 
19
- return Promise.resolve();
20
+ // Create migrations/package.json to ensure migration files are
21
+ // executed as CJS and not ESM
22
+ // https://github.com/db-migrate/node-db-migrate/issues/721
23
+ const packageJsonPath = path.resolve(dir, 'package.json');
24
+
25
+ await stat(packageJsonPath).then(
26
+ async () => {
27
+ const packageJson = require(packageJsonPath);
28
+ packageJson.type = 'commonjs';
29
+ const packageJsonStr = JSON.stringify(packageJson, null, 2);
30
+ await writeFile(packageJsonPath, packageJsonStr, 'utf-8');
31
+ },
32
+ async (err) => {
33
+ const packageJson = JSON.stringify({
34
+ type: 'commonjs'
35
+ }, null, 2)
36
+ await writeFile(packageJsonPath, packageJson, 'utf-8');
37
+ }
38
+ )
20
39
  }
21
40
 
22
41
  async function executeCreateMigration (internals, config) {
@@ -155,6 +174,7 @@ async function executeCreateMigration (internals, config) {
155
174
  internals.plugins
156
175
  );
157
176
  await migration.write();
177
+ log.info(util.format('Created migration at %s', migration.file.path));
158
178
  }
159
179
  );
160
180
  }
@@ -22,7 +22,7 @@ async function prepare (internals, config) {
22
22
  Migrator
23
23
  );
24
24
 
25
- migrator.migrationsDir = path.resolve(internals.argv['migrations-dir']);
25
+ migrator.directory = path.resolve(internals.argv['migrations-dir']);
26
26
 
27
27
  await migrator.createMigrationsTable();
28
28
  log.verbose('migration table created');
@@ -0,0 +1,53 @@
1
+ var path = require('path');
2
+ var log = require('db-migrate-shared').log;
3
+ var migrationHook = require('./helper/migration-hook.js');
4
+
5
+ async function prepare (internals, config) {
6
+ try {
7
+ await migrationHook(internals);
8
+ var Migrator = require('../walker.js');
9
+ var index = require('../../connect');
10
+
11
+ if (!internals.argv.count) {
12
+ internals.argv.count = Number.MAX_VALUE;
13
+ }
14
+ const migrator = await index.connect(
15
+ {
16
+ config: config.getCurrent().settings,
17
+ internals: internals,
18
+ prefix: 'migration'
19
+ },
20
+ Migrator
21
+ );
22
+
23
+ if (internals.locTitle) {
24
+ migrator.directory = path.resolve(
25
+ internals.argv['migrations-dir'],
26
+ internals.locTitle
27
+ );
28
+ } else {
29
+ migrator.directory = path.resolve(internals.argv['migrations-dir']);
30
+ }
31
+
32
+ internals.migrationsDir = migrator.directory;
33
+ const backupState = internals.argv['backup-state'];
34
+
35
+ await migrator.createMigrationsTable({ emptyState: true, backupState });
36
+ log.verbose('migration table created');
37
+
38
+ return migrator;
39
+ } catch (err) {
40
+ throw err;
41
+ }
42
+ }
43
+
44
+ module.exports = async function (internals, config) {
45
+ const migrator = await prepare(internals, config);
46
+
47
+ try {
48
+ const res = await migrator.fix(internals.argv);
49
+ return internals.onComplete(migrator, internals, null, res);
50
+ } catch (err) {
51
+ return internals.onComplete(migrator, internals, err);
52
+ }
53
+ };
@@ -9,6 +9,7 @@ const files = {
9
9
  "db": require('./db.js'),
10
10
  "down": require('./down.js'),
11
11
  "dump": require('./dump.js'),
12
+ "fix": require('./fix.js'),
12
13
  "fn/plugin": require('./fn/plugin.js'),
13
14
  "generated": require('./generated.js'),
14
15
  "helper/assert": require('./helper/assert.js'),
@@ -1,17 +1,18 @@
1
1
  'use strict';
2
2
 
3
3
  var log = require('db-migrate-shared').log;
4
+ var formatError = require('../../format-error');
4
5
 
5
6
  function registerEvents () {
6
7
  process.on('uncaughtException', function (err) {
7
8
  log.error('uncaughtException');
8
- log.error(err.stack || err);
9
+ log.error(formatError(err, { verbose: global.verbose }));
9
10
  process.exit(1);
10
11
  });
11
12
 
12
13
  process.on('unhandledRejection', function (reason) {
13
14
  log.error('unhandledRejection');
14
- log.error(reason.stack || reason);
15
+ log.error(formatError(reason, { verbose: global.verbose }));
15
16
  process.exit(1);
16
17
  });
17
18
  }
@@ -2,6 +2,17 @@
2
2
 
3
3
  var log = require('db-migrate-shared').log;
4
4
  var yargs = require('yargs');
5
+ var formatError = require('../format-error');
6
+
7
+ /**
8
+ * Print a failed command once, with the context of the failure, and exit.
9
+ */
10
+ function report (result) {
11
+ return Promise.resolve(result).catch(function (err) {
12
+ log.error(formatError(err, { verbose: global.verbose }));
13
+ process.exit(1);
14
+ });
15
+ }
5
16
 
6
17
  function run (internals, config) {
7
18
  const { load } = internals;
@@ -16,7 +27,7 @@ function run (internals, config) {
16
27
  internals.matching = folder[1];
17
28
  internals.migrationMode = folder[1];
18
29
  }
19
- load('create-migration')(internals, config);
30
+ report(load('create-migration')(internals, config));
20
31
  break;
21
32
  case 'sync':
22
33
  var executeSync = load('sync');
@@ -34,8 +45,9 @@ function run (internals, config) {
34
45
  internals.migrationMode = folder[1];
35
46
  }
36
47
 
37
- executeSync(internals, config);
48
+ report(executeSync(internals, config));
38
49
  break;
50
+ case 'fix':
39
51
  case 'up':
40
52
  case 'down':
41
53
  case 'reset':
@@ -57,10 +69,13 @@ function run (internals, config) {
57
69
 
58
70
  if (action === 'up') {
59
71
  var executeUp = load('up');
60
- executeUp(internals, config);
72
+ report(executeUp(internals, config));
73
+ } else if (action === 'fix') {
74
+ var executeFix = load('fix');
75
+ report(executeFix(internals, config));
61
76
  } else {
62
77
  var executeDown = load('down');
63
- executeDown(internals, config);
78
+ report(executeDown(internals, config));
64
79
  }
65
80
  break;
66
81
 
@@ -72,14 +87,14 @@ function run (internals, config) {
72
87
  internals.migrationMode = folder[1];
73
88
  }
74
89
 
75
- executeCheck(internals, config);
90
+ report(executeCheck(internals, config));
76
91
  break;
77
92
  case 'db':
78
93
  if (folder.length < 1) {
79
94
  log.info('Please enter a valid command, i.e. db:create|db:drop');
80
95
  } else {
81
96
  internals.mode = folder[1];
82
- load('db')(internals, config);
97
+ report(load('db')(internals, config));
83
98
  }
84
99
  break;
85
100
  case 'seed':
@@ -92,9 +107,9 @@ function run (internals, config) {
92
107
  }
93
108
 
94
109
  internals.argv._.shift();
95
- load('undo-seed')(internals, config);
110
+ report(load('undo-seed')(internals, config));
96
111
  } else {
97
- load('seed')(internals, config);
112
+ report(load('seed')(internals, config));
98
113
  }
99
114
  break;
100
115
 
@@ -1,48 +1,14 @@
1
1
  'use strict';
2
2
 
3
- var assert = require('assert');
4
- var path = require('path');
5
- var _assert = require('./helper/assert');
6
-
7
- function executeSeed (internals, config, callback) {
8
- var index = require('../../connect');
9
- var Seeder = require('../walker.js');
10
-
11
- if (internals.argv._.length > 0) {
12
- internals.argv.destination = internals.argv._.shift().toString();
13
- }
14
-
15
- index.connect(
16
- {
17
- config: config.getCurrent().settings,
18
- internals: internals,
19
- prefix: 'seed'
20
- },
21
- Seeder,
22
- function (err, seeder) {
23
- assert.ifError(err);
24
- var seedDir =
25
- internals.mode !== 'static' ? 'vcseeder-dir' : 'staticseeder-dir';
26
-
27
- seeder.seedDir = path.resolve(internals.argv[seedDir]);
28
-
29
- if (internals.mode === 'static') {
30
- seeder.seed(
31
- internals.argv,
32
- internals.onComplete.bind(this, seeder, internals, callback)
33
- );
34
- } else {
35
- seeder.createSeedsTable(function (err) {
36
- if (_assert(err, callback)) {
37
- seeder.seed(
38
- internals.argv,
39
- internals.onComplete.bind(this, seeder, internals, callback)
40
- );
41
- }
42
- });
43
- }
44
- }
3
+ /**
4
+ * Seeders are not part of db-migrate 1.0, their implementation was never
5
+ * finished. A new concept follows separately, see #687.
6
+ */
7
+ module.exports = function () {
8
+ return Promise.reject(
9
+ new Error(
10
+ 'Seeders are not supported by db-migrate 1.0. The unfinished seeders ' +
11
+ 'of db-migrate 0.11 are still available there.'
12
+ )
45
13
  );
46
- }
47
-
48
- module.exports = executeSeed;
14
+ };
@@ -16,7 +16,10 @@ module.exports = function (internals, isModule) {
16
16
  'migrations-dir': internals.cwd + '/migrations',
17
17
  'vcseeder-dir': internals.cwd + '/VCSeeder',
18
18
  'staticseeder-dir': internals.cwd + '/Seeder',
19
- 'ignore-completed-migrations': false
19
+ 'ignore-completed-migrations': false,
20
+ 'backup-state': false,
21
+ 'lock-timeout': 60000,
22
+ 'lock-interval': 1000
20
23
  };
21
24
 
22
25
  if (!isModule) {
@@ -113,6 +116,19 @@ module.exports = function (internals, isModule) {
113
116
  .boolean('ignore-completed-migrations')
114
117
  .describe('log-level', 'Set the log-level, for example sql|warn')
115
118
  .string('log-level')
119
+ .describe('backup-state', 'For use with fix, to take a backup of the current state before continuing.')
120
+ .boolean('backup-state')
121
+ .describe(
122
+ 'lock-timeout',
123
+ 'Milliseconds without any sign of life after which a migration lock' +
124
+ ' held by another process is considered stale and taken over.'
125
+ )
126
+ .number('lock-timeout')
127
+ .describe(
128
+ 'lock-interval',
129
+ 'Milliseconds between checks while waiting for the migration lock.'
130
+ )
131
+ .number('lock-interval')
116
132
  .parse();
117
133
  } else {
118
134
  internals.argv = Object.assign(defaultConfig, internals.cmdOptions);