Skip to content

Commit

Permalink
fix: max revision query order (#4096)
Browse files Browse the repository at this point in the history
  • Loading branch information
sjaanus committed Jun 27, 2023
1 parent 464ef5b commit 803610a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lib/db/event-store.ts
Expand Up @@ -158,8 +158,11 @@ class EventStore implements IEventStore {
async getMaxRevisionId(largerThan: number = 0): Promise<number> {
const row = await this.db(TABLE)
.max('id')
.whereNotNull('feature_name')
.orWhere('type', SEGMENT_UPDATED)
.where((builder) =>
builder
.whereNotNull('feature_name')
.orWhere('type', SEGMENT_UPDATED),
)
.andWhere('id', '>=', largerThan)
.first();
return row ? row.max : -1;
Expand Down

0 comments on commit 803610a

Please sign in to comment.