diff options
Diffstat (limited to '')
-rw-r--r-- | database.h | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/database.h b/database.h index 2481262..eec6cb6 100644 --- a/database.h +++ b/database.h @@ -151,44 +151,44 @@ static inline int dbVersion(sqlite3 *db) { static const char *InitSQL = { "BEGIN TRANSACTION;" "CREATE TABLE networks (" - "id INTEGER PRIMARY KEY," + "network INTEGER PRIMARY KEY," "name TEXT NOT NULL UNIQUE" ");" "CREATE TABLE contexts (" - "id INTEGER PRIMARY KEY," - "networkID INTEGER NOT NULL REFERENCES networks," + "context INTEGER PRIMARY KEY," + "network INTEGER NOT NULL REFERENCES networks," "name TEXT NOT NULL," "query BOOLEAN NOT NULL," - "UNIQUE (networkID, name)" + "UNIQUE (network, name)" ");" "CREATE TABLE names (" - "id INTEGER PRIMARY KEY," + "name INTEGER PRIMARY KEY," "nick TEXT NOT NULL," "user TEXT NOT NULL," "host TEXT NOT NULL," "UNIQUE (nick, user, host)" ");" "CREATE TABLE events (" - "id INTEGER PRIMARY KEY," + "event INTEGER PRIMARY KEY," "time DATETIME NOT NULL," "type INTEGER NOT NULL," - "contextID INTEGER NOT NULL REFERENCES contexts," - "nameID INTEGER NOT NULL REFERENCES names," + "context INTEGER NOT NULL REFERENCES contexts," + "name INTEGER NOT NULL REFERENCES names," "target TEXT," "message TEXT" ");" "CREATE VIRTUAL TABLE search USING fts5 (" "message," "content = events," - "content_rowid = id," + "content_rowid = event," "tokenize = 'porter'" ");" "CREATE TRIGGER eventsInsert AFTER INSERT ON events BEGIN" - " INSERT INTO search (rowid, message) VALUES (new.id, new.message);" + " INSERT INTO search (rowid, message) VALUES (new.event, new.message);" "END;" "CREATE TRIGGER eventsDelete AFTER DELETE ON events BEGIN" " INSERT INTO search (search, rowid, message)" - " VALUES ('delete', old.id, old.message);" + " VALUES ('delete', old.event, old.message);" "END;" "COMMIT TRANSACTION;" }; |