summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndrew Morgan <1342360+anoadragon453@users.noreply.github.com>2019-12-04 12:17:47 +0000
committerGitHub <noreply@github.com>2019-12-04 12:17:47 +0000
commit85901939c11784248fd56d41c1d6a1987c0f4336 (patch)
treeba0920469460ad9340dc391ae2e79f4d00d1c549
parentMerge pull request #6451 from matrix-org/uhoreg/cross_signing_signatures_index (diff)
parentUpdate changelog.d/6449.bugfix (diff)
downloadsynapse-85901939c11784248fd56d41c1d6a1987c0f4336.tar.xz
Fix error when using synapse_port_db on a vanilla synapse db (#6449)
-rw-r--r--changelog.d/6449.bugfix1
-rwxr-xr-xscripts/synapse_port_db5
2 files changed, 5 insertions, 1 deletions
diff --git a/changelog.d/6449.bugfix b/changelog.d/6449.bugfix
new file mode 100644
index 0000000000..002f33c450
--- /dev/null
+++ b/changelog.d/6449.bugfix
@@ -0,0 +1 @@
+Fix error when using synapse_port_db on a vanilla synapse db.
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)