From cd4ab940db12bec3734bc8a03468f2c570a7e3ed Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Wed, 30 Sep 2020 15:25:51 -0400 Subject: [PATCH] backup blob hashes --- backupdb.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/backupdb.go b/backupdb.go index b40c24b..8f3c675 100644 --- a/backupdb.go +++ b/backupdb.go @@ -170,20 +170,21 @@ func svalbard(dirname string) { if err != nil { log.Fatalf("can't open backup blob database") } - doordie(blob, "create table filedata (xid text, media text, content blob)") + 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)") tx, err = blob.Begin() if err != nil { log.Fatalf("can't start transaction: %s", err) } origblob := openblobdb() for x := range filexids { - rows = qordie(origblob, "select xid, media, content from filedata where xid = ?", x) + rows = qordie(origblob, "select xid, media, hash, content from filedata where xid = ?", x) for rows.Next() { - var xid, media string + var xid, media, hash string var content sql.RawBytes - scanordie(rows, &xid, &media, &content) - doordie(tx, "insert into filedata (xid, media, content) values (?, ?, ?)", xid, media, content) + scanordie(rows, &xid, &media, &hash, &content) + doordie(tx, "insert into filedata (xid, media, hash, content) values (?, ?, ?)", xid, media, hash, content) } rows.Close() }