Fix updating rooms/events

This commit is contained in:
Neil Alexander 2021-04-19 14:17:06 +01:00
parent 1957497e69
commit 2168c13d67
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -169,11 +169,11 @@ func UpStateBlocksRefactor(tx *sql.Tx) error {
return fmt.Errorf("tx.QueryRow.Scan (insert new snapshot): %w", err)
}
_, err = tx.Exec(`UPDATE roomserver_events SET state_snapshot_nid=$1 WHERE state_snapshot_nid=$2`, newsnapshot, snapshot)
_, err = tx.Exec(`UPDATE roomserver_events SET state_snapshot_nid=$1 WHERE state_snapshot_nid=$2`, newsnapshot, snapshot.StateSnapshotNID)
if err != nil {
return fmt.Errorf("tx.Exec (update events): %w", err)
}
_, err = tx.Exec(`UPDATE roomserver_rooms SET state_snapshot_nid=$1 WHERE state_snapshot_nid=$2`, newsnapshot, snapshot)
_, err = tx.Exec(`UPDATE roomserver_rooms SET state_snapshot_nid=$1 WHERE state_snapshot_nid=$2`, newsnapshot, snapshot.StateSnapshotNID)
if err != nil {
return fmt.Errorf("tx.Exec (update rooms): %w", err)
}