Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 1397f83

Browse files
committed
Fix error when using synapse_port_db on a vanilla synapse db (#6449)
* commit '85901939c': Update changelog.d/6449.bugfix Add changelog Fix error when using synapse_port_db on a vanilla synapse db
2 parents f4ae176 + 8590193 commit 1397f83

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

changelog.d/6449.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix error when using synapse_port_db on a vanilla synapse db.

scripts/synapse_port_db

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,10 @@ class Porter(object):
782782
def _setup_state_group_id_seq(self):
783783
def r(txn):
784784
txn.execute("SELECT MAX(id) FROM state_groups")
785-
next_id = txn.fetchone()[0] + 1
785+
curr_id = txn.fetchone()[0]
786+
if not curr_id:
787+
return
788+
next_id = curr_id + 1
786789
txn.execute("ALTER SEQUENCE state_group_id_seq RESTART WITH %s", (next_id,))
787790

788791
return self.postgres_store.runInteraction("setup_state_group_id_seq", r)

0 commit comments

Comments
 (0)