diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2021-05-10 13:02:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-10 13:02:55 +0100 |
commit | 51065c44bb0875373fada2838e69e4bc5005a95d (patch) | |
tree | 00ae020731d559f59e87267d50f647c9962014cc /scripts/synapse_port_db | |
parent | Always cache 'event_to_prev_state_group' (#9950) (diff) | |
download | synapse-51065c44bb0875373fada2838e69e4bc5005a95d.tar.xz |
Fix port_db on empty db (#9930)
... and test it.
Diffstat (limited to 'scripts/synapse_port_db')
-rwxr-xr-x | scripts/synapse_port_db | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/scripts/synapse_port_db b/scripts/synapse_port_db index f0c93d5226..5fb5bb35f7 100755 --- a/scripts/synapse_port_db +++ b/scripts/synapse_port_db @@ -913,10 +913,11 @@ class Porter(object): (curr_forward_id + 1,), ) - txn.execute( - "ALTER SEQUENCE events_backfill_stream_seq RESTART WITH %s", - (curr_backward_id + 1,), - ) + if curr_backward_id: + txn.execute( + "ALTER SEQUENCE events_backfill_stream_seq RESTART WITH %s", + (curr_backward_id + 1,), + ) await self.postgres_store.db_pool.runInteraction( "_setup_events_stream_seqs", _setup_events_stream_seqs_set_pos, @@ -954,10 +955,11 @@ class Porter(object): (curr_chain_id,), ) - await self.postgres_store.db_pool.runInteraction( - "_setup_event_auth_chain_id", r, - ) - + if curr_chain_id is not None: + await self.postgres_store.db_pool.runInteraction( + "_setup_event_auth_chain_id", + r, + ) ############################################## |