Skip to content

Commit

Permalink
improvement: close connections after db:seed command
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Jun 20, 2020
1 parent fd2ce31 commit daab588
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion commands/DbSeed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* file that was distributed with this source code.
*/

// import { join } from 'path'
import { inject } from '@adonisjs/fold'
import { SeederFileNode } from '@ioc:Adonis/Lucid/Seeder'
import { BaseCommand, Kernel, flags } from '@adonisjs/ace'
Expand Down Expand Up @@ -105,7 +106,8 @@ export default class DbSeed extends BaseCommand {
}

const { SeedsRunner } = await import('../src/SeedsRunner')
const runner = new SeedsRunner(this.application.seedsPath(), process.env.NODE_ENV === 'development')
const seedsPath = this.application.seedsPath()
const runner = new SeedsRunner(seedsPath, process.env.NODE_ENV === 'development')

/**
* List of available files
Expand Down Expand Up @@ -151,5 +153,7 @@ export default class DbSeed extends BaseCommand {
this.printLogMessage(sourceFile)
}
}

await this.db.manager.closeAll(true)
}
}

0 comments on commit daab588

Please sign in to comment.