mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-04-04 02:53:40 +00:00
Use pq.Int64Array for newblocks
This commit is contained in:
parent
c3fb1c1ba5
commit
1957497e69
1 changed files with 6 additions and 1 deletions
|
@ -153,13 +153,18 @@ func UpStateBlocksRefactor(tx *sql.Tx) error {
|
|||
newblocks = append(newblocks, blocknid)
|
||||
|
||||
if snapshot.StateSnapshotNID != lastsnapshot {
|
||||
var newblocksarray pq.Int64Array
|
||||
for _, b := range newblocks {
|
||||
newblocksarray = append(newblocksarray, int64(b))
|
||||
}
|
||||
|
||||
var newsnapshot types.StateSnapshotNID
|
||||
err = tx.QueryRow(`
|
||||
INSERT INTO roomserver_state_snapshots (room_nid, state_block_nids)
|
||||
VALUES ($1, $2)
|
||||
ON CONFLICT (room_nid, state_block_nids) DO UPDATE SET room_nid=$1
|
||||
RETURNING state_snapshot_nid
|
||||
`, snapshot.RoomNID, newblocks).Scan(&newsnapshot)
|
||||
`, snapshot.RoomNID, newblocksarray).Scan(&newsnapshot)
|
||||
if err != nil {
|
||||
return fmt.Errorf("tx.QueryRow.Scan (insert new snapshot): %w", err)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue