diff options
author | Mark Haines <mark.haines@matrix.org> | 2016-09-09 11:52:44 +0100 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2016-09-09 11:52:44 +0100 |
commit | 647c7245733a72b9b71decb2b321869a942dbb88 (patch) | |
tree | b5a5f53074088b241a2a9f17702f6bd71dca38d3 /synapse/storage | |
parent | Track the max_stream_device_id in a separate table, since we delete from the ... (diff) | |
download | synapse-647c7245733a72b9b71decb2b321869a942dbb88.tar.xz |
Use the previous MAX value if any to set the stream_id
Diffstat (limited to 'synapse/storage')
-rw-r--r-- | synapse/storage/schema/delta/35/device_stream_id.sql | 3 |
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; |