diff --git a/honk.go b/honk.go index 4b34c6a..bb2d055 100644 --- a/honk.go +++ b/honk.go @@ -235,7 +235,8 @@ func showrss(w http.ResponseWriter, r *http.Request) { func butwhatabout(name string) (*WhatAbout, error) { row := stmtWhatAbout.QueryRow(name) var user WhatAbout - err := row.Scan(&user.ID, &user.Name, &user.Display, &user.About, &user.Key) + var options string + err := row.Scan(&user.ID, &user.Name, &user.Display, &user.About, &user.Key, &options) user.URL = fmt.Sprintf("https://%s/u/%s", serverName, user.Name) return &user, err } @@ -1525,7 +1526,7 @@ func prepareStatements(db *sql.DB) { stmtZonkDonks = preparetodie(db, "delete from donks where honkid = ?") stmtFindFile = preparetodie(db, "select fileid from files where url = ? and local = 1") stmtSaveFile = preparetodie(db, "insert into files (xid, name, url, media, local, content) values (?, ?, ?, ?, ?, ?)") - stmtWhatAbout = preparetodie(db, "select userid, username, displayname, about, pubkey from users where username = ?") + stmtWhatAbout = preparetodie(db, "select userid, username, displayname, about, pubkey, options from users where username = ?") stmtSaveDub = preparetodie(db, "insert into honkers (userid, name, xid, flavor) values (?, ?, ?, ?)") stmtAddDoover = preparetodie(db, "insert into doovers (dt, tries, username, rcpt, msg) values (?, ?, ?, ?, ?)") stmtGetDoovers = preparetodie(db, "select dooverid, dt from doovers") diff --git a/schema.sql b/schema.sql index f9a900b..55ffc10 100644 --- a/schema.sql +++ b/schema.sql @@ -18,7 +18,7 @@ create index idx_filesurl on files(url); create table config (key text, value text); -create table users (userid integer primary key, username text, hash text, displayname text, about text, pubkey text, seckey text); +create table users (userid integer primary key, username text, hash text, displayname text, about text, pubkey text, seckey text, options text); create table auth (authid integer primary key, userid integer, hash text); CREATE index idxusers_username on users(username); CREATE index idxauth_userid on auth(userid); diff --git a/upgradedb.go b/upgradedb.go index d652448..23d2458 100644 --- a/upgradedb.go +++ b/upgradedb.go @@ -102,6 +102,9 @@ func upgradedb() { doordie(db, "update zonkers set wherefore = 'zord' where wherefore = 'zword'") doordie(db, "update config set value = 11 where key = 'dbversion'") case 11: + doordie(db, "alter table users add column options text") + doordie(db, "update users set options = ''") + doordie(db, "update config set value = 12 where key = 'dbversion'") default: log.Fatalf("can't upgrade unknown version %d", dbversion) } diff --git a/util.go b/util.go index 414b0db..19da525 100644 --- a/util.go +++ b/util.go @@ -71,7 +71,7 @@ var dbtimeformat = "2006-01-02 15:04:05" var alreadyopendb *sql.DB var dbname = "honk.db" var stmtConfig *sql.Stmt -var myVersion = 11 +var myVersion = 12 func initdb() { schema, err := ioutil.ReadFile("schema.sql")