Skip to content

Commit

Permalink
Port script: Set up state_group_id_seq
Browse files Browse the repository at this point in the history
  • Loading branch information
richvdh committed Apr 6, 2018
1 parent 0157938 commit 6a9777b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions scripts/synapse_port_db
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,9 @@ class Porter(object):
consumeErrors=True,
)

# Step 5. Do final post-processing
yield self._setup_state_group_id_seq()

self.progress.done()
except:
global end_error_exec_info
Expand Down Expand Up @@ -709,6 +712,16 @@ class Porter(object):

defer.returnValue((done, remaining + done))

def _setup_state_group_id_seq(self):
def r(txn):
txn.execute("SELECT MAX(id) FROM state_groups")
next_id = txn.fetchone()[0]+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)


##############################################
###### The following is simply UI stuff ######
Expand Down

0 comments on commit 6a9777b

Please sign in to comment.