Ship database creation script as embedded resource
This commit is contained in:
5
shared/create.qrc
Normal file
5
shared/create.qrc
Normal file
@ -0,0 +1,5 @@
|
||||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource>
|
||||
<file>create.sql</file>
|
||||
</qresource>
|
||||
</RCC>
|
14
shared/create.sql
Normal file
14
shared/create.sql
Normal file
@ -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;
|
@ -40,3 +40,4 @@ unix {
|
||||
target.path = /usr/lib
|
||||
INSTALLS += target
|
||||
}
|
||||
RESOURCES = create.qrc
|
||||
|
Reference in New Issue
Block a user