Skip to content

Commit

Permalink
Update CHANGELOG
Browse files Browse the repository at this point in the history
  • Loading branch information
ingalls committed Jun 21, 2024
1 parent 62c055f commit 17f50e5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@

## Version History

### v19.2.1

- :bug: Count function was returning a string

### v19.2.0

- :rocket: Throw 404 error on `commit` that doesn't update any rows
Expand Down
8 changes: 4 additions & 4 deletions generic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class GenericEmitter<T extends GenericTable> extends EventEmitter {
async start() {
try {
const count = await this.pool.select({
count: sql<number>`count(*) OVER()`.as('count')
count: sql<string>`count(*) OVER()`.as('count')
}).from(this.generic)
.where(this.query.where)

Expand All @@ -84,7 +84,7 @@ export class GenericEmitter<T extends GenericTable> extends EventEmitter {
return;
}

this.emit('count', count[0].count);
this.emit('count', parseInt(count[0].count));

let it = 0;
let pgres: any = [];
Expand Down Expand Up @@ -148,11 +148,11 @@ export default class Drizzle<T extends GenericTable> {

async count(query: GenericCountInput = {}): Promise<number> {
const pgres = await this.pool.select({
count: sql<number>`count(*)`.as('count'),
count: sql<string>`count(*)`.as('count'),
}).from(this.generic)
.where(query.where)

return pgres[0].count;
return parseInt(pgres[0].count);
}

async list(query: GenericListInput = {}): Promise<GenericList<InferSelectModel<T>>> {
Expand Down

0 comments on commit 17f50e5

Please sign in to comment.