backup code hasn't been well maintained

This commit is contained in:
Ted Unangst 2023-08-31 02:57:49 -04:00
parent ae3843690f
commit 281570fe6b
1 changed files with 6 additions and 4 deletions

View File

@ -35,6 +35,7 @@ func svalbard(dirname string) {
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 @@ func svalbard(dirname string) {
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 @@ func svalbard(dirname string) {
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)")