summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2019-12-02 18:23:41 +0000
committerAndrew Morgan <andrew@amorgan.xyz>2019-12-02 18:23:41 +0000
commit57f09e01f528b796d6448446f56ac8079988e6ab (patch)
treef7f717422ee8a5713ad188a06cb9dcc18c1f6b45 /scripts
parentTransfer power level state events on room upgrade (#6237) (diff)
downloadsynapse-57f09e01f528b796d6448446f56ac8079988e6ab.tar.xz
Fix error when using synapse_port_db on a vanilla synapse db
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/synapse_port_db5
1 files changed, 4 insertions, 1 deletions
diff --git a/scripts/synapse_port_db b/scripts/synapse_port_db
index 0d3321682c..f24b8ffe67 100755
--- a/scripts/synapse_port_db
+++ b/scripts/synapse_port_db
@@ -782,7 +782,10 @@ class Porter(object):
     def _setup_state_group_id_seq(self):
         def r(txn):
             txn.execute("SELECT MAX(id) FROM state_groups")
-            next_id = txn.fetchone()[0] + 1
+            curr_id = txn.fetchone()[0]
+            if not curr_id:
+                return
+            next_id = curr_id + 1
             txn.execute("ALTER SEQUENCE state_group_id_seq RESTART WITH %s", (next_id,))
 
         return self.postgres_store.runInteraction("setup_state_group_id_seq", r)