08fb2fe467
* Add option to reset viewer flags * Review Changes * Run `resetViewerFlags()` content with `launchIO`
49 lines
1.0 KiB
Plaintext
49 lines
1.0 KiB
Plaintext
import java.lang.String;
|
|
import kotlin.collections.List;
|
|
|
|
CREATE TABLE mangas(
|
|
_id INTEGER NOT NULL PRIMARY KEY,
|
|
source INTEGER NOT NULL,
|
|
url TEXT NOT NULL,
|
|
artist TEXT,
|
|
author TEXT,
|
|
description TEXT,
|
|
genre TEXT AS List<String>,
|
|
title TEXT NOT NULL,
|
|
status INTEGER NOT NULL,
|
|
thumbnail_url TEXT,
|
|
favorite INTEGER AS Boolean NOT NULL,
|
|
last_update INTEGER AS Long,
|
|
next_update INTEGER AS Long,
|
|
initialized INTEGER AS Boolean NOT NULL,
|
|
viewer INTEGER NOT NULL,
|
|
chapter_flags INTEGER NOT NULL,
|
|
cover_last_modified INTEGER AS Long NOT NULL,
|
|
date_added INTEGER AS Long NOT NULL
|
|
);
|
|
|
|
CREATE INDEX library_favorite_index ON mangas(favorite) WHERE favorite = 1;
|
|
CREATE INDEX mangas_url_index ON mangas(url);
|
|
|
|
getMangaById:
|
|
SELECT *
|
|
FROM mangas
|
|
WHERE _id = :id;
|
|
|
|
getSourceIdWithFavoriteCount:
|
|
SELECT
|
|
source,
|
|
count(*)
|
|
FROM mangas
|
|
WHERE favorite = 1
|
|
GROUP BY source;
|
|
|
|
getFavoriteBySourceId:
|
|
SELECT *
|
|
FROM mangas
|
|
WHERE favorite = 1
|
|
AND source = :sourceId;
|
|
|
|
resetViewerFlags:
|
|
UPDATE mangas
|
|
SET viewer = 0; |