backup code hasn't been well maintained
Ted Unangst tedu@tedunangst.com
Thu, 31 Aug 2023 02:57:49 -0400
1 files changed,
6 insertions(+),
4 deletions(-)
jump to
M
backupdb.go
→
backupdb.go
@@ -35,6 +35,7 @@ backup, err := sql.Open("sqlite3", backupdbname)
if err != nil { elog.Fatalf("can't open backup database") } + _, err = backup.Exec("PRAGMA journal_mode=WAL") for _, line := range strings.Split(sqlSchema, ";") { _, err = backup.Exec(line) if err != nil {@@ -76,16 +77,16 @@ rows.Close()
honkids := make(map[int64]bool) for c := range convoys { - rows = qordie(orig, "select honkid, userid, what, honker, xid, rid, dt, url, audience, noise, convoy, whofore, format, precis, oonker, flags from honks where convoy = ?", c) + rows = qordie(orig, "select honkid, userid, what, honker, xid, rid, dt, url, audience, noise, convoy, whofore, format, precis, oonker, flags, plain from honks where convoy = ?", c) for rows.Next() { var honkid, userid int64 - var what, honker, xid, rid, dt, url, audience, noise, convoy string + var what, honker, xid, rid, dt, url, audience, noise, convoy, plain string var whofore int64 var format, precis, oonker string var flags int64 - scanordie(rows, &honkid, &userid, &what, &honker, &xid, &rid, &dt, &url, &audience, &noise, &convoy, &whofore, &format, &precis, &oonker, &flags) + scanordie(rows, &honkid, &userid, &what, &honker, &xid, &rid, &dt, &url, &audience, &noise, &convoy, &whofore, &format, &precis, &oonker, &flags, &plain) honkids[honkid] = true - doordie(tx, "insert into honks (honkid, userid, what, honker, xid, rid, dt, url, audience, noise, convoy, whofore, format, precis, oonker, flags) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", honkid, userid, what, honker, xid, rid, dt, url, audience, noise, convoy, whofore, format, precis, oonker, flags) + doordie(tx, "insert into honks (honkid, userid, what, honker, xid, rid, dt, url, audience, noise, convoy, whofore, format, precis, oonker, flags, plain) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", honkid, userid, what, honker, xid, rid, dt, url, audience, noise, convoy, whofore, format, precis, oonker, flags, plain) } rows.Close() }@@ -169,6 +170,7 @@ blob, err := sql.Open("sqlite3", backupblobname)
if err != nil { elog.Fatalf("can't open backup blob database") } + _, err = blob.Exec("PRAGMA journal_mode=WAL") doordie(blob, "create table filedata (xid text, media text, hash text, content blob)") doordie(blob, "create index idx_filexid on filedata(xid)") doordie(blob, "create index idx_filehash on filedata(hash)")