refactor(db): Migrate last history queries (that can be migrated) to SQLDelight

This commit is contained in:
Ahmad Ansori Palembani 2024-11-29 17:05:59 +07:00
parent 8cef33d9c6
commit 17b07cd836
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6
5 changed files with 36 additions and 72 deletions

View file

@ -45,6 +45,17 @@ WHERE chapters.url = :chapterUrl AND history.history_chapter_id = chapters._id;
getTotalReadDuration:
SELECT sum(history_time_read) FROM history;
getPerPeriod:
SELECT mangas.*, chapters.*, history.*
FROM mangas
JOIN chapters
ON mangas._id = chapters.manga_id
JOIN history
ON chapters._id = history.history_chapter_id
AND history.history_last_read >= :startDate
AND history.history_last_read <= :endDate
ORDER BY history.history_last_read DESC;
getRecentsUngrouped:
SELECT
M.*,