summary refs log tree commit diff
path: root/database.h
diff options
context:
space:
mode:
Diffstat (limited to 'database.h')
-rw-r--r--database.h22
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;"
 };
mmit/bin/when.y?id=a069d2def79de1f880b1177976e5dca6cdccf7b5&follow=1'>Add named dates to whenJune McEnroe 2022-08-14Remove tweets text fileJune McEnroe 2022-08-04Add Conversations With FriendsJune McEnroe 2022-07-30Add Normal PeopleJune McEnroe 2022-07-26Rewrite glitch from new pngoJune McEnroe 2022-07-26Update Care with time-to-ID and piercingsJune McEnroe 2022-07-26Add -w to upJune McEnroe 2022-07-13Set push.autoSetupRemoteJune McEnroe 2022-07-08Remove TOURJune McEnroe 2022-07-03Add The Bone Shard EmperorJune McEnroe 2022-06-25Bump xterm font size to 12June McEnroe 2022-06-10Handle subshells (and functions) inside substitutionsJune McEnroe 2022-06-10Switch to jorts Install scriptJune McEnroe 2022-06-08Indicate if still reading or no resultsJune McEnroe 2022-06-08Add Maiden, Mother, CroneJune McEnroe 2022-06-05FIRST SHOW IN 2.5 YEARS BABEY!!!June McEnroe 2022-06-03Set line number on File linesJune McEnroe 2022-06-03Stop polling stdin after EOFJune McEnroe 2022-06-02Set TABSIZE=4June McEnroe 2022-06-02Do basic match highlightingJune McEnroe 2022-06-02Clean up parsing a littleJune McEnroe 2022-06-02Don't duplicate path stringJune McEnroe 2022-06-02Use stderr instead of /dev/tty, realloc buffer if lines too longJune McEnroe 2022-06-02Add initial working version of qfJune McEnroe 2022-05-29Set prompt for okshJune McEnroe