1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-20 00:08:02 +01:00

fix: max revision query order (#4096)

This commit is contained in:
Jaanus Sellin 2023-06-27 12:07:23 +03:00 committed by GitHub
parent 464ef5b326
commit 803610ab82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;