summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2020-10-21 18:01:25 +0100
committerErik Johnston <erik@matrix.org>2020-10-21 18:01:25 +0100
commit44f727446a6434f070de41ae3323d5eb53245bfa (patch)
tree46a20e06c94e6a7103212765fd7d546a8c31b9ac
parentMerge pull request #8572 from matrix-org/rav/cache_hacking/2 (diff)
downloadsynapse-erikj/fix_port_script.tar.xz
-rwxr-xr-xscripts/synapse_port_db2
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/synapse_port_db b/scripts/synapse_port_db
index 6c7664ad4a..9794d004f5 100755
--- a/scripts/synapse_port_db
+++ b/scripts/synapse_port_db
@@ -818,7 +818,7 @@ class Porter(object):
                     "ALTER SEQUENCE events_stream_seq RESTART WITH %s", (next_id,)
                 )
 
-            txn.execute("SELECT -MIN(stream_ordering) FROM events")
+            txn.execute("SELECT GREATEST(-MIN(stream_ordering), 1) FROM events")
             curr_id = txn.fetchone()[0]
             if curr_id:
                 next_id = curr_id + 1