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

Commit

Permalink
Fix error when using synapse_port_db on a vanilla synapse db (#6449)
Browse files Browse the repository at this point in the history
  • Loading branch information
anoadragon453 authored Dec 4, 2019
2 parents 2aa8943 + 768b844 commit 8590193
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/6449.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix error when using synapse_port_db on a vanilla synapse db.
5 changes: 4 additions & 1 deletion scripts/synapse_port_db
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 8590193

Please sign in to comment.