cleanup some old mistakes and cruft from the database
Ted Unangst tedu@tedunangst.com
Sat, 15 Jul 2023 17:59:44 -0400
7 files changed,
8 insertions(+),
19 deletions(-)
M
activity.go
→
activity.go
@@ -850,9 +850,6 @@ if ot == "Move" {
targ, _ := obj.GetString("target") content += string(templates.Sprintf(`<p>Moved to <a href="%s">%s</a>`, targ, targ)) } - if what == "honk" && rid != "" { - what = "tonk" - } if len(content) > 90001 { ilog.Printf("content too long. truncating") content = content[:90001]@@ -1238,8 +1235,6 @@ }
switch h.What { case "update": - fallthrough - case "tonk": fallthrough case "event": fallthrough
M
database.go
→
database.go
@@ -504,8 +504,6 @@ if err != nil {
elog.Printf("error parsing badonks: %s", err) continue } - case "wonkles": - case "guesses": case "oldrev": default: elog.Printf("unknown meta genus: %s", genus)@@ -1158,7 +1156,7 @@ stmtEventHonks = preparetodie(db, selecthonks+"where (whofore = 2 or honks.userid = ?) and what = 'event'"+smalllimit)
stmtUserHonks = preparetodie(db, selecthonks+"where honks.honkid > ? and (whofore = 2 or whofore = ?) and username = ? and dt > ?"+smalllimit) myhonkers := " and honker in (select xid from honkers where userid = ? and (flavor = 'sub' or flavor = 'peep' or flavor = 'presub') and combos not like '% - %')" stmtHonksForUser = preparetodie(db, selecthonks+"where honks.honkid > ? and honks.userid = ? and dt > ?"+myhonkers+butnotthose+limit) - stmtHonksForUserFirstClass = preparetodie(db, selecthonks+"where honks.honkid > ? and honks.userid = ? and dt > ? and (what <> 'tonk')"+myhonkers+butnotthose+limit) + stmtHonksForUserFirstClass = preparetodie(db, selecthonks+"where honks.honkid > ? and honks.userid = ? and dt > ? and (rid = '' or what = 'bonk')"+myhonkers+butnotthose+limit) stmtHonksForMe = preparetodie(db, selecthonks+"where honks.honkid > ? and honks.userid = ? and dt > ? and whofore = 1"+butnotthose+limit) stmtHonksFromLongAgo = preparetodie(db, selecthonks+"where honks.honkid > ? and honks.userid = ? and dt > ? and dt < ? and whofore = 2"+butnotthose+limit) stmtHonksISaved = preparetodie(db, selecthonks+"where honks.honkid > ? and honks.userid = ? and flags & 4 order by honks.honkid desc")
M
import.go
→
import.go
@@ -148,9 +148,6 @@ Whofore: 2,
Format: "html", Precis: toot.Object.Summary, } - if honk.RID != "" { - honk.What = "tonk" - } if !loudandproud(honk.Audience) { honk.Whofore = 3 }@@ -387,13 +384,11 @@ what := "honk"
noise := "" if parent := tweetmap[t.Tweet.InReplyToStatusID]; parent != nil { t.convoy = parent.convoy - what = "tonk" } else { t.convoy = "data:,acoustichonkytonk-" + t.Tweet.IdStr if t.Tweet.InReplyToScreenName != "" { noise = fmt.Sprintf("re: https://twitter.com/%s/status/%s\n\n", t.Tweet.InReplyToScreenName, t.Tweet.InReplyToStatusID) - what = "tonk" } } audience := []string{thewholeworld}
M
upgradedb.go
→
upgradedb.go
@@ -20,7 +20,7 @@ "database/sql"
"os" ) -var myVersion = 42 +var myVersion = 43 type dbexecer interface { Exec(query string, args ...interface{}) (sql.Result, error)@@ -82,6 +82,11 @@ }
doordie(db, "update config set value = 42 where key = 'dbversion'") fallthrough case 42: + doordie(db, "update honks set what = 'honk', flags = flags & ~ 32 where what = 'tonk' or what = 'wonk'") + doordie(db, "delete from honkmeta where genus = 'wonkles' or genus = 'guesses'") + doordie(db, "update config set value = 43 where key = 'dbversion'") + fallthrough + case 43: default: elog.Fatalf("can't upgrade unknown version %d", dbversion)