From 9c20a5c321c4c96a9de009a940850b45bbc15964 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Tue, 9 Jul 2019 23:45:50 -0400 Subject: [PATCH] more queries, more indices. index oonker --- schema.sql | 1 + upgradedb.go | 3 +++ util.go | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/schema.sql b/schema.sql index 55ffc10..f4683b7 100644 --- a/schema.sql +++ b/schema.sql @@ -10,6 +10,7 @@ create table doovers(dooverid integer primary key, dt text, tries integer, usern create index idx_honksxid on honks(xid); create index idx_honksconvoy on honks(convoy); create index idx_honkshonker on honks(honker); +create index idx_honksoonker on honks(oonker); create index idx_honkerxid on honkers(xid); create index idx_xonkername on xonkers(name); create index idx_zonkersname on zonkers(name); diff --git a/upgradedb.go b/upgradedb.go index 1b326fc..9e5744f 100644 --- a/upgradedb.go +++ b/upgradedb.go @@ -106,6 +106,9 @@ func upgradedb() { doordie(db, "update users set options = ''") doordie(db, "update config set value = 12 where key = 'dbversion'") case 12: + doordie(db, "create index idx_honksoonker on honks(oonker)") + doordie(db, "update config set value = 13 where key = 'dbversion'") + case 13: default: log.Fatalf("can't upgrade unknown version %d", dbversion) } diff --git a/util.go b/util.go index 19da525..76c85ce 100644 --- a/util.go +++ b/util.go @@ -71,7 +71,7 @@ var dbtimeformat = "2006-01-02 15:04:05" var alreadyopendb *sql.DB var dbname = "honk.db" var stmtConfig *sql.Stmt -var myVersion = 12 +var myVersion = 13 func initdb() { schema, err := ioutil.ReadFile("schema.sql")