Ship database creation script as embedded resource

此提交包含在:
2020-08-24 21:33:56 +02:00
父節點 8b298fb85b
當前提交 7c1e12d589
共有 3 個檔案被更改,包括 6 行新增0 行删除

14
shared/create.sql 一般檔案
查看文件

@@ -0,0 +1,14 @@
CREATE TABLE file(id INTEGER PRIMARY KEY, path varchar(4096) UNIQUE, mtime integer, size integer, filetype char(1));
CREATE TABLE content(id INTEGER PRIMARY KEY, fileid INTEGER REFERENCES file (id) ON DELETE CASCADE, page integer, content text);
CREATE VIRTUAL TABLE content_fts USING fts5(content, content='content', content_rowid='id')
/* content_fts(content) */;
CREATE TRIGGER contents_ai AFTER INSERT ON content BEGIN
INSERT INTO content_fts(rowid, content) VALUES (new.id, new.content);
END;
CREATE TRIGGER contents_ad AFTER DELETE ON content BEGIN
INSERT INTO content_fts(content_fts, rowid, content) VALUES('delete', old.id, old.content);
END;
CREATE TRIGGER contents_au AFTER UPDATE ON content BEGIN
INSERT INTO content_fts(content_fts, rowid, content) VALUES('delete', old.id, old.content);
INSERT INTO content_fts(rowid, content) VALUES (new.id, new.content);
END;