Skip to content

Commit

Permalink
Fix makeMigrationMode schema, use server.root.stop()
Browse files Browse the repository at this point in the history
  • Loading branch information
wswoodruff committed Sep 14, 2017
1 parent 1f7053e commit 4259439
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions lib/index.js
Expand Up @@ -199,10 +199,14 @@ internals.initialize = (server, next) => {

if (err) {
console.error(err);
process.exit(1);
server.root.stop(() => {

This comment has been minimized.

Copy link
@devinivy

devinivy Sep 14, 2017

Member

Don't want to swallow a stop error!

This comment has been minimized.

Copy link
@devinivy

devinivy Sep 14, 2017

Member

Don't forget to return so you don't stop twice.

This comment has been minimized.

Copy link
@wswoodruff

wswoodruff Sep 14, 2017

Author Member

Whaddaya mean swallow a stop error?

This comment has been minimized.

Copy link
@devinivy

devinivy Sep 14, 2017

Member

If an error occurs during stop, how would the developer find out? I'm referencing the err that is passed to this callback.

process.exit(1);

This comment has been minimized.

Copy link
@devinivy

devinivy Sep 14, 2017

Member

Line at the beginning of a function.

});
}

process.exit(0);
server.root.stop(() => {
process.exit(0);

This comment has been minimized.

Copy link
@devinivy

devinivy Sep 14, 2017

Member

Line at the beginning of a function.

});
});
}

Expand Down
2 changes: 1 addition & 1 deletion lib/schema.js
Expand Up @@ -9,7 +9,7 @@ internals.model = Joi.func(); // Really, a class
internals.configBase = Joi.object({
knex: [Joi.object(), Joi.func()], // Either a knex config (object) or a knex instance (func)
migrationsDir: Joi.string(),
makeMigrationMode: Joi.boolean()
makeMigrationMode: Joi.string().allow('create', 'alter', 'test').optional()
});

exports.plugin = internals.configBase.keys({
Expand Down

0 comments on commit 4259439

Please sign in to comment.