Schema definitions for Sqlite data base. Configure script will generate an empty data base for the type provider.

This commit is contained in:
Achim D. Brucker 2017-08-12 18:26:15 +01:00
parent c41f33d6ea
commit 1a367f9916
3 changed files with 46 additions and 0 deletions

4
.gitignore vendored
View File

@ -202,3 +202,7 @@ docsrc/content/license.md
docsrc/content/release-notes.md
.fake
docsrc/tools/FSharp.Formatting.svclog
# local resources
src/resources/extensions-schema.sqlite

View File

@ -35,3 +35,8 @@ else
echo "Please install Mono.Data.Sqlite.dll into packages/SQLProvider/lib."
fi
fi
echo "Creating empty database for type provider."
rm -f src/resources/extensions-schema.sqlite
sqlite3 src/resources/extensions-schema.sqlite < src/resources/extensions-schema.sql

View File

@ -0,0 +1,37 @@
CREATE TABLE support(author, commentdate, extid, date, displayname, title, language, shortauthor, comment, PRIMARY KEY (author, commentdate, extid, date));
CREATE VIRTUAL TABLE support_fts using fts4(content="support", author, commentdate, extid, date, displayname, title, language, shortauthor, comment);
CREATE TABLE IF NOT EXISTS 'support_fts_segments'(blockid INTEGER PRIMARY KEY, block BLOB);
CREATE TABLE IF NOT EXISTS 'support_fts_segdir'(level INTEGER,idx INTEGER,start_block INTEGER,leaves_end_block INTEGER,end_block INTEGER,root BLOB,PRIMARY KEY(level, idx));
CREATE TABLE IF NOT EXISTS 'support_fts_docsize'(docid INTEGER PRIMARY KEY, size BLOB);
CREATE TABLE IF NOT EXISTS 'support_fts_stat'(id INTEGER PRIMARY KEY, value BLOB);
CREATE TRIGGER support_bu BEFORE UPDATE ON support BEGIN DELETE FROM support_fts WHERE docid=old.rowid;END;
CREATE TRIGGER support_bd BEFORE DELETE ON support BEGIN DELETE FROM support_fts WHERE docid=old.rowid;END;
CREATE TRIGGER support_au AFTER UPDATE ON support BEGIN INSERT INTO support_fts(docid, author, commentdate, extid, date, displayname, title, language, shortauthor, comment) VALUES(new.rowid, new.author, new.commentdate, new.extid, new.date, new.displayname, new.title, new.language, new.shortauthor, new.comment);END;
CREATE TRIGGER support_ai AFTER INSERT ON support BEGIN INSERT INTO support_fts(docid, author, commentdate, extid, date, displayname, title, language, shortauthor, comment) VALUES(new.rowid, new.author, new.commentdate, new.extid, new.date, new.displayname, new.title, new.language, new.shortauthor, new.comment);END;
CREATE TABLE review(author, commentdate, extid, date, displayname, rating, language, shortauthor, comment, PRIMARY KEY (author, commentdate, extid, date));
CREATE VIRTUAL TABLE review_fts using fts4(content="review", author, commentdate, extid, date, displayname, rating, language, shortauthor, comment);
CREATE TABLE IF NOT EXISTS 'review_fts_segments'(blockid INTEGER PRIMARY KEY, block BLOB);
CREATE TABLE IF NOT EXISTS 'review_fts_segdir'(level INTEGER,idx INTEGER,start_block INTEGER,leaves_end_block INTEGER,end_block INTEGER,root BLOB,PRIMARY KEY(level, idx));
CREATE TABLE IF NOT EXISTS 'review_fts_docsize'(docid INTEGER PRIMARY KEY, size BLOB);
CREATE TABLE IF NOT EXISTS 'review_fts_stat'(id INTEGER PRIMARY KEY, value BLOB);
CREATE TRIGGER review_bu BEFORE UPDATE ON review BEGIN DELETE FROM review_fts WHERE docid=old.rowid;END;
CREATE TRIGGER review_bd BEFORE DELETE ON review BEGIN DELETE FROM review_fts WHERE docid=old.rowid;END;
CREATE TRIGGER review_au AFTER UPDATE ON review BEGIN INSERT INTO review_fts(docid, author, commentdate, extid, date, displayname, rating, language, shortauthor, comment) VALUES(new.rowid, new.author, new.commentdate, new.extid, new.date, new.displayname, new.rating, new.language, new.shortauthor, new.comment);END;
CREATE TRIGGER review_ai AFTER INSERT ON review BEGIN INSERT INTO review_fts(docid, author, commentdate, extid, date, displayname, rating, language, shortauthor, comment) VALUES(new.rowid, new.author, new.commentdate, new.extid, new.date, new.displayname, new.rating, new.language, new.shortauthor, new.comment);END;
CREATE TABLE reply(author, commentdate, extid, date, displayname, replyto, language, shortauthor, comment, PRIMARY KEY (author, commentdate, extid, date));
CREATE VIRTUAL TABLE reply_fts using fts4(content="reply", author, commentdate, extid, date, displayname, replyto, language, shortauthor, comment);
CREATE TABLE IF NOT EXISTS 'reply_fts_segments'(blockid INTEGER PRIMARY KEY, block BLOB);
CREATE TABLE IF NOT EXISTS 'reply_fts_segdir'(level INTEGER,idx INTEGER,start_block INTEGER,leaves_end_block INTEGER,end_block INTEGER,root BLOB,PRIMARY KEY(level, idx));
CREATE TABLE IF NOT EXISTS 'reply_fts_docsize'(docid INTEGER PRIMARY KEY, size BLOB);
CREATE TABLE IF NOT EXISTS 'reply_fts_stat'(id INTEGER PRIMARY KEY, value BLOB);
CREATE TRIGGER reply_bu BEFORE UPDATE ON reply BEGIN DELETE FROM reply_fts WHERE docid=old.rowid;END;
CREATE TRIGGER reply_bd BEFORE DELETE ON reply BEGIN DELETE FROM reply_fts WHERE docid=old.rowid;END;
CREATE TRIGGER reply_au AFTER UPDATE ON reply BEGIN INSERT INTO reply_fts(docid, author, commentdate, extid, date, displayname, replyto, language, shortauthor, comment) VALUES(new.rowid, new.author, new.commentdate, new.extid, new.date, new.displayname, new.replyto, new.language, new.shortauthor, new.comment);END;
CREATE TRIGGER reply_ai AFTER INSERT ON reply BEGIN INSERT INTO reply_fts(docid, author, commentdate, extid, date, displayname, replyto, language, shortauthor, comment) VALUES(new.rowid, new.author, new.commentdate, new.extid, new.date, new.displayname, new.replyto, new.language, new.shortauthor, new.comment);END;
CREATE TABLE category (extid TEXT,date TEXT,category TEXT,PRIMARY KEY (extid, date, category));
CREATE TABLE content_script_url (crx_etag TEXT,url TEXT,PRIMARY KEY (crx_etag, url));
CREATE TABLE permission (crx_etag TEXT,permission TEXT,PRIMARY KEY (crx_etag, permission));
CREATE TABLE crx (crx_etag TEXT PRIMARY KEY,filename TEXT,size INTEGER,publickey BLOB);
CREATE TABLE jsfile (crx_etag TEXT,path TEXT,size INTEGER,md5 TEXT,PRIMARY KEY (crx_etag, path));
CREATE TABLE status (extid TEXT,date TEXT,crx_status INTEGER,overview_status INTEGER,overview_exception TEXT,PRIMARY KEY (extid, date));
CREATE TABLE extension (extid TEXT,date TEXT,name TEXT,version TEXT,description TEXT,downloads INTEGER,rating REAL,ratingcount INTEGER,fulldescription TEXT,developer TEXT,itemcategory TEXT,crx_etag TEXT,lastupdated TEXT,PRIMARY KEY (extid, date),FOREIGN KEY (crx_etag) REFERENCES crx(crx_etag));