CREATE TABLE search_tags (
    _id INTEGER NOT NULL PRIMARY KEY,
    manga_id INTEGER NOT NULL,
    namespace TEXT,
    name TEXT NOT NULL,
    type INTEGER AS Int NOT NULL,
    FOREIGN KEY(manga_id) REFERENCES mangas (_id)
    ON DELETE CASCADE
);

CREATE INDEX search_tags_manga_id_index ON search_tags(manga_id);
CREATE INDEX search_tags_namespace_name_index ON search_tags(namespace, name);


selectByMangaId:
SELECT * FROM search_tags
WHERE manga_id = ?;

deleteByManga:
DELETE FROM search_tags WHERE manga_id = ?;

insert:
INSERT INTO search_tags (manga_id, namespace, name, type)
VALUES (?, ?, ?, ?);

insertItem:
INSERT INTO search_tags (_id, manga_id, namespace, name, type)
VALUES ?;

deleteAll:
DELETE FROM search_titles;