Merge manga favorite related fields into favorite_at

Migration 16 replaces favorite, date_added and favorite_modified_at with one nullable favorite_at. A favorite whose date_added is 0 falls back to favorite_modified_at. Manga.favorite and dateAdded become getters derived from it, and restore merges it by taking the earliest non-zero time.
This commit is contained in:
AntsyLich
2026-09-27 22:37:02 +06:00
parent f8fff318ba
commit 986f46c09a
18 changed files with 183 additions and 109 deletions
@@ -10,7 +10,7 @@ SELECT
chapters.bookmark,
chapters.last_page_read,
mangas.source,
mangas.favorite,
mangas.favorite_at IS NOT NULL AS favorite,
mangas.thumbnail_url AS thumbnailUrl,
mangas.cover_last_modified AS coverLastModified,
chapters.date_upload AS dateUpload,
@@ -21,8 +21,8 @@ ON mangas._id = chapters.manga_id
LEFT JOIN excluded_scanlators
ON mangas._id = excluded_scanlators.manga_id
AND chapters.scanlator = excluded_scanlators.scanlator
WHERE favorite = 1
AND date_fetch > date_added
WHERE favorite_at IS NOT NULL
AND date_fetch > favorite_at
ORDER BY date_fetch DESC;
getRecentUpdates: