Schema for docs
CREATE TABLE [sections] (
[id] TEXT PRIMARY KEY,
[page] TEXT,
[ref] TEXT,
[title] TEXT,
[content] TEXT,
[breadcrumbs] TEXT,
[references] TEXT
);
CREATE VIRTUAL TABLE [sections_fts] USING FTS5 (
[title], [content],
tokenize='porter',
content=[sections]
);
CREATE TABLE 'sections_fts_data'(id INTEGER PRIMARY KEY, block BLOB);
CREATE TABLE 'sections_fts_idx'(segid, term, pgno, PRIMARY KEY(segid, term)) WITHOUT ROWID;
CREATE TABLE 'sections_fts_docsize'(id INTEGER PRIMARY KEY, sz BLOB);
CREATE TABLE 'sections_fts_config'(k PRIMARY KEY, v) WITHOUT ROWID;
CREATE TRIGGER [sections_ai] AFTER INSERT ON [sections] BEGIN
INSERT INTO [sections_fts] (rowid, [title], [content]) VALUES (new.rowid, new.[title], new.[content]);
END;
CREATE TRIGGER [sections_ad] AFTER DELETE ON [sections] BEGIN
INSERT INTO [sections_fts] ([sections_fts], rowid, [title], [content]) VALUES('delete', old.rowid, old.[title], old.[content]);
END;
CREATE TRIGGER [sections_au] AFTER UPDATE ON [sections] BEGIN
INSERT INTO [sections_fts] ([sections_fts], rowid, [title], [content]) VALUES('delete', old.rowid, old.[title], old.[content]);
INSERT INTO [sections_fts] (rowid, [title], [content]) VALUES (new.rowid, new.[title], new.[content]);
END