From 8be74bc88f17db74202e29323d9a950678247a13 Mon Sep 17 00:00:00 2001 From: Harminder virk Date: Tue, 22 Oct 2019 14:26:24 +0530 Subject: [PATCH] fix: use correct query constructs for truncating table --- package.json | 2 +- src/QueryClient/index.ts | 2 +- src/TransactionClient/index.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 05e28f12..131b5c3e 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "@adonisjs/sink": "^2.2.3", "@poppinss/dev-utils": "^1.0.1", "@types/dotenv": "^6.1.1", - "@types/node": "^12.11.1", + "@types/node": "^12.11.2", "@types/pluralize": "0.0.29", "clone": "^2.1.2", "commitizen": "^4.0.3", diff --git a/src/QueryClient/index.ts b/src/QueryClient/index.ts index 0505511a..3e57234d 100644 --- a/src/QueryClient/index.ts +++ b/src/QueryClient/index.ts @@ -102,7 +102,7 @@ export class QueryClient implements QueryClientContract { * Truncate table */ public async truncate (table: string): Promise { - await this.getWriteClient().select(table).truncate() + await this.getWriteClient().table(table).truncate() } /** diff --git a/src/TransactionClient/index.ts b/src/TransactionClient/index.ts index f12bd847..0b5be9f4 100644 --- a/src/TransactionClient/index.ts +++ b/src/TransactionClient/index.ts @@ -82,7 +82,7 @@ export class TransactionClient extends EventEmitter implements TransactionClient * Truncate tables inside a transaction */ public async truncate (table: string): Promise { - await this.knexClient.select(table).truncate() + await this.knexClient.table(table).truncate() } /**