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