diff options
author | Erik Johnston <erik@matrix.org> | 2018-01-11 15:25:47 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2018-01-12 10:06:03 +0000 |
commit | 3c62aac038c0bd13b4e0546511ec7901871840c7 (patch) | |
tree | cc9ae22ff706a4dd694ebc3982c2e3b521aeb84a | |
parent | Move store_state_group to StateReadStore (diff) | |
download | synapse-3c62aac038c0bd13b4e0546511ec7901871840c7.tar.xz |
Make port script aware of handle_state_group_seq
-rwxr-xr-x | scripts/synapse_port_db | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/scripts/synapse_port_db b/scripts/synapse_port_db index d46581e4e1..8441fae734 100755 --- a/scripts/synapse_port_db +++ b/scripts/synapse_port_db @@ -425,6 +425,20 @@ class Porter(object): else: return + def handle_state_group_seq(self): + """Updates postgres handle_state_group_seq with last state_group ID + """ + def handle_state_group_seq_txn(txn): + txn.execute(""" + SELECT setval('state_group_id_seq', + SELECT COALESCE(MAX(id), 0) FROM state_groups + ) + """) + + return self.postgres_store.runInteraction( + "handle_state_group_seq", handle_state_group_seq_txn, + ) + def setup_db(self, db_config, database_engine): db_conn = database_engine.module.connect( **{ @@ -548,6 +562,8 @@ class Porter(object): consumeErrors=True, ) + yield self.handle_state_group_seq() + self.progress.done() except: global end_error_exec_info |