Fix conflict statements

This commit is contained in:
Neil Alexander 2021-04-20 15:56:49 +01:00
parent dc056f7e40
commit f858b5ac7c
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
2 changed files with 2 additions and 2 deletions

View file

@ -49,7 +49,7 @@ CREATE TABLE IF NOT EXISTS roomserver_state_block (
const insertStateDataSQL = "" +
"INSERT INTO roomserver_state_block (state_block_hash, event_nids)" +
" VALUES ($1, $2)" +
" ON CONFLICT (event_nids) DO UPDATE SET event_nids=$2" +
" ON CONFLICT (state_block_hash) DO UPDATE SET event_nids=$2" +
" RETURNING state_block_nid"
const bulkSelectStateBlockEntriesSQL = "" +

View file

@ -50,7 +50,7 @@ CREATE TABLE IF NOT EXISTS roomserver_state_snapshots (
const insertStateSQL = "" +
"INSERT INTO roomserver_state_snapshots (state_snapshot_hash, room_nid, state_block_nids)" +
" VALUES ($1, $2, $3)" +
" ON CONFLICT (room_nid, state_block_nids) DO UPDATE SET room_nid=$2" +
" ON CONFLICT (state_snapshot_hash) DO UPDATE SET room_nid=$2" +
// Performing an update, above, ensures that the RETURNING statement
// below will always return a valid state snapshot ID
" RETURNING state_snapshot_nid"