Skip to content

Commit

Permalink
fix(commands): close database connection after commands
Browse files Browse the repository at this point in the history
db:seed and migration:status gracefully close database connections
  • Loading branch information
thetutlage committed Jul 16, 2017
1 parent 5a93394 commit 4ad9402
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/Commands/Seed.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ class Seed extends Command {
this.success(`${this.icon('success')} seeded database successfully`)
} catch (e) {
this.error(e)
} finally {
const MigrationsRunner = this.migrations
new MigrationsRunner().database.close()
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/Commands/Status.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ class Status extends Command {
this.table(['Migration', 'Status'], response)
} catch (e) {
this.error(e)
} finally {
migrationsRunner.database.close()
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/Migrations/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ class Migrations {
*/
* status (files) {
const migrate = yield this._diff(files, 'up')
this.database.close()
return _.transform(files, function (result, file, name) {
if (migrate.indexOf(name) > -1) {
result[name] = 'N'
Expand Down

0 comments on commit 4ad9402

Please sign in to comment.