refactor(db): Replace some more StorIO queries with SQLDelight

- Manga: db.getManga -> getManga.await*
- History
- Chapter: db.updateChapter* -> updateChapter.await; db.getChapter -> getChapter.await*
This commit is contained in:
Ahmad Ansori Palembani 2024-11-23 19:28:59 +07:00
parent 822cfa56a6
commit 5378d2a99b
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6
8 changed files with 81 additions and 33 deletions

View file

@ -9,6 +9,26 @@ CREATE TABLE history(
CREATE INDEX history_history_chapter_id_index ON history(history_chapter_id);
upsert:
INSERT INTO history(history_chapter_id, history_last_read, history_time_read)
VALUES(:historyChapterId, :historyLastRead, :historyTimeRead)
ON CONFLICT(history_chapter_id)
DO UPDATE
SET
history_last_read = :historyLastRead,
history_time_read = :historyTimeRead
WHERE history_chapter_id = history_chapter_id;
selectLastInsertedRowId:
SELECT last_insert_rowid();
getByChapterUrl:
SELECT history.*
FROM history
JOIN chapters
ON history.history_chapter_id = chapters._id
WHERE chapters.url = :chapterUrl AND history.history_chapter_id = chapters._id;
getRecentsUngrouped:
SELECT
M.*,