Skip to content

Commit

Permalink
fix: sqlite limited delete query bug (#2111)
Browse files Browse the repository at this point in the history
  • Loading branch information
ABresting authored Oct 9, 2023
1 parent a0033df commit 06bc433
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions waku/waku_archive/driver/sqlite_driver/queries.nim
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,9 @@ proc deleteMessagesOlderThanTimestamp*(db: SqliteDatabase, ts: int64):
## Delete oldest messages not within limit

proc deleteOldestMessagesNotWithinLimitQuery(table: string, limit: int): SqlQueryStr =
"DELETE FROM " & table & " WHERE id NOT IN (" &
" SELECT id FROM " & table &
" ORDER BY storedAt DESC" &
"DELETE FROM " & table & " WHERE (storedAt, id, pubsubTopic) NOT IN (" &
" SELECT storedAt, id, pubsubTopic FROM " & table &
" ORDER BY storedAt DESC, id DESC" &
" LIMIT " & $limit &
");"

Expand Down

0 comments on commit 06bc433

Please sign in to comment.