db: match placeholders with columns

Soju inserts 9 columns but only with 8 placeholders. This causes
channels not being saved properly and also logging errors like this:

    downstream ...: failed to create or update channel ...: 8 values for 9 columns
This commit is contained in:
Alexey Yerin 2021-04-26 23:24:25 +03:00 committed by Simon Ser
parent 9b40cfe95c
commit cc83da4cd1
1 changed files with 1 additions and 1 deletions

2
db.go
View File

@ -596,7 +596,7 @@ func (db *DB) StoreChannel(networkID int64, ch *Channel) error {
} else {
var res sql.Result
res, err = db.db.Exec(`INSERT INTO Channel(network, name, key, detached, detached_internal_msgid, relay_detached, reattach_on, detach_after, detach_on)
VALUES (?, ?, ?, ?, ?, ?, ?, ?)`,
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`,
networkID, ch.Name, key, ch.Detached, toNullString(ch.DetachedInternalMsgID), ch.RelayDetached, ch.ReattachOn, detachAfter, ch.DetachOn)
if err != nil {
return err