summary refs log tree commit diff
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2016-09-09 11:52:44 +0100
committerMark Haines <mark.haines@matrix.org>2016-09-09 11:52:44 +0100
commit647c7245733a72b9b71decb2b321869a942dbb88 (patch)
treeb5a5f53074088b241a2a9f17702f6bd71dca38d3
parentTrack the max_stream_device_id in a separate table, since we delete from the ... (diff)
downloadsynapse-647c7245733a72b9b71decb2b321869a942dbb88.tar.xz
Use the previous MAX value if any to set the stream_id
-rw-r--r--synapse/storage/schema/delta/35/device_stream_id.sql3
1 files changed, 2 insertions, 1 deletions
diff --git a/synapse/storage/schema/delta/35/device_stream_id.sql b/synapse/storage/schema/delta/35/device_stream_id.sql
index 1ce6336f33..7ab7d942e2 100644
--- a/synapse/storage/schema/delta/35/device_stream_id.sql
+++ b/synapse/storage/schema/delta/35/device_stream_id.sql
@@ -17,4 +17,5 @@ CREATE TABLE device_max_stream_id (
     stream_id BIGINT NOT NULL
 );
 
-INSERT INTO device_max_stream_id (stream_id) VALUES (0);
+INSERT INTO device_max_stream_id (stream_id)
+    SELECT COALESCE(MAX(stream_id), 0) FROM device_inbox;