all repos — honk @ 8dadee71f96f6f7be168a4ba624b3c6c5bd3f199

my fork of honk

don't delete oldrevs when cleaning meta
Ted Unangst tedu@tedunangst.com
Wed, 02 Oct 2019 17:29:02 -0400
commit

8dadee71f96f6f7be168a4ba624b3c6c5bd3f199

parent

5d1d335ed23a42ecbdfc6a38265d53bd6488345a

1 files changed, 12 insertions(+), 2 deletions(-)

jump to
M database.godatabase.go

@@ -342,6 +342,16 @@ log.Printf("error saving place: %s", err)

return err } } + if p := h.Time; p != nil { + j, err := jsonify(p) + if err != nil { + _, err = stmtSaveMeta.Exec(h.ID, "time", j) + } + if err != nil { + log.Printf("error saving time: %s", err) + return err + } + } return nil }

@@ -355,7 +365,7 @@ _, err = stmtDeleteOnts.Exec(honkid)

if err != nil { log.Printf("error deleting: %s", err) } - _, err = stmtDeleteMeta.Exec(honkid) + _, err = stmtDeleteMeta.Exec(honkid, "oldrev") if err != nil { log.Printf("error deleting: %s", err) }

@@ -519,7 +529,7 @@ stmtHonksByConvoy = preparetodie(db, selecthonks+"where (honks.userid = ? or (? = -1 and whofore = 2)) and convoy = ?"+limit)

stmtHonksByOntology = preparetodie(db, selecthonks+"join onts on honks.honkid = onts.honkid where onts.ontology = ? and (honks.userid = ? or (? = -1 and honks.whofore = 2))"+limit) stmtSaveMeta = preparetodie(db, "insert into honkmeta (honkid, genus, json) values (?, ?, ?)") - stmtDeleteMeta = preparetodie(db, "delete from honkmeta where honkid = ?") + stmtDeleteMeta = preparetodie(db, "delete from honkmeta where honkid = ? and genus <> ?") stmtSaveHonk = preparetodie(db, "insert into honks (userid, what, honker, xid, rid, dt, url, audience, noise, convoy, whofore, format, precis, oonker, flags) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)") stmtDeleteHonk = preparetodie(db, "delete from honks where honkid = ?") stmtUpdateHonk = preparetodie(db, "update honks set precis = ?, noise = ?, format = ?, dt = ? where honkid = ?")