diff --git a/src/commands/DbSeedCommand.ts b/src/commands/DbSeedCommand.ts index 7420e7c..2d37cf7 100644 --- a/src/commands/DbSeedCommand.ts +++ b/src/commands/DbSeedCommand.ts @@ -37,13 +37,15 @@ export class DbSeedCommand extends BaseCommand { public async handle(): Promise { this.logger.simple('({bold,green} [ SEEDING DATABASE ])\n') + const task = this.logger.task() const DB = Database.connection(this.connection) if (this.getConfig('driver') === 'mongo') { - await Exec.sleep(1000) + task.addPromise('Connecting to database', async () => { + await Exec.sleep(5000) + }) } - const task = this.logger.task() const dbName = await DB.getCurrentDatabase() await DB.runSeeders({ task, classes: this.classes }) diff --git a/src/commands/DbWipeCommand.ts b/src/commands/DbWipeCommand.ts index 09e64a2..014f40a 100644 --- a/src/commands/DbWipeCommand.ts +++ b/src/commands/DbWipeCommand.ts @@ -34,11 +34,13 @@ export class DbWipeCommand extends BaseCommand { const task = this.logger.task() if (this.getConfig('driver') === 'mongo') { - await Exec.sleep(1000) + task.addPromise('Connecting to database', () => { + return Exec.sleep(5000) + }) - const tables = await DB.getTables() + task.addPromise('Dropping all database tables', async () => { + const tables = await DB.getTables() - task.addPromise('Dropping all database tables', () => { return Exec.concurrently(tables, table => DB.dropTable(table)) }) } else { @@ -53,12 +55,14 @@ export class DbWipeCommand extends BaseCommand { ) } - const dbName = await DB.getCurrentDatabase() + await task.run().finally(async () => { + const dbName = await DB.getCurrentDatabase() - await task.run().finally(() => DB.close()) + await DB.close() - console.log() - this.logger.success(`Database ({yellow} "${dbName}") successfully wiped.`) + console.log() + this.logger.success(`Database ({yellow} "${dbName}") successfully wiped.`) + }) } private getConfig(name: string, defaultValue?: any) {