mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-23 14:53:10 -06:00
stop the peek table growing by reusing rows correctly
This commit is contained in:
parent
b1d1ccdbc8
commit
9561843772
|
|
@ -44,7 +44,9 @@ CREATE INDEX IF NOT EXISTS syncapi_peeks_user_id_device_id_idx ON syncapi_peeks(
|
|||
const insertPeekSQL = "" +
|
||||
"INSERT INTO syncapi_peeks" +
|
||||
" (room_id, user_id, device_id, creation_ts)" +
|
||||
" VALUES ($1, $2, $3, $4) RETURNING id"
|
||||
" VALUES ($1, $2, $3, $4)" +
|
||||
" ON CONFLICT (room_id, user_id, device_id) DO UPDATE SET deleted=false, creation_ts=$4" +
|
||||
" RETURNING id"
|
||||
|
||||
const deletePeekSQL = "" +
|
||||
"UPDATE syncapi_peeks SET deleted=true, id=nextval('syncapi_stream_id') WHERE room_id = $1 AND user_id = $2 AND device_id = $3 RETURNING id"
|
||||
|
|
|
|||
|
|
@ -42,9 +42,9 @@ CREATE INDEX IF NOT EXISTS syncapi_peeks_user_id_device_id_idx ON syncapi_peeks(
|
|||
`
|
||||
|
||||
const insertPeekSQL = "" +
|
||||
"INSERT INTO syncapi_peeks" +
|
||||
" (id, room_id, user_id, device_id, creation_ts)" +
|
||||
" VALUES ($1, $2, $3, $4, $5)"
|
||||
"INSERT OR REPLACE INTO syncapi_peeks" +
|
||||
" (id, room_id, user_id, device_id, creation_ts, deleted)" +
|
||||
" VALUES ($1, $2, $3, $4, $5, false)"
|
||||
|
||||
const deletePeekSQL = "" +
|
||||
"UPDATE syncapi_peeks SET deleted=true, id=$1 WHERE room_id = $2 AND user_id = $3 AND device_id = $4"
|
||||
|
|
|
|||
Loading…
Reference in a new issue