Skip to content

Commit

Permalink
fix(knex): respect explicit transaction in em.count() (#2818)
Browse files Browse the repository at this point in the history
Co-authored-by: Asi Farran <[email protected]>
  • Loading branch information
asiFarran and Asi Farran authored Feb 24, 2022
1 parent 725ff91 commit 2d26a63
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/knex/src/AbstractSqlDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,10 @@ export abstract class AbstractSqlDriver<C extends AbstractSqlConnection = Abstra
}
}

async count<T extends AnyEntity<T>>(entityName: string, where: any, options: CountOptions<T> = {}, ctx?: Transaction<Knex.Transaction>): Promise<number> {
async count<T extends AnyEntity<T>>(entityName: string, where: any, options: CountOptions<T> = {}): Promise<number> {
const meta = this.metadata.find(entityName)!;
const pks = meta.primaryKeys;
const qb = this.createQueryBuilder(entityName, ctx, !!ctx, false)
const qb = this.createQueryBuilder(entityName, options.ctx, !!options.ctx, false)
.groupBy(options.groupBy!)
.having(options.having!)
.populate(options.populate as unknown as PopulateOptions<T>[] ?? [])
Expand Down

0 comments on commit 2d26a63

Please sign in to comment.