summary refs log tree commit diff
diff options
context:
space:
mode:
-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;