From d7d24750be64913a10335603f7a48dbba10e51b0 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Thu, 20 Jul 2017 10:47:01 +0100 Subject: [PATCH 1/2] Fix port script for user directory tables --- scripts/synapse_port_db | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/scripts/synapse_port_db b/scripts/synapse_port_db index 7d158a46a4..8da8a3b1d2 100755 --- a/scripts/synapse_port_db +++ b/scripts/synapse_port_db @@ -252,6 +252,24 @@ class Porter(object): ) return + if table in ( + "user_directory", "user_directory_search", "users_who_share_rooms", + "users_in_pubic_room", + ): + # We don't port these tables, as they're a faff and we can regenreate + # them anyway. + self.progress.update(table, table_size) # Mark table as done + return + + if table == "user_directory_stream_pos": + # We need to make sure there is a single row, `(X, null)` + yield self.postgres_store._simple_insert( + table=table, + values={"stream_id": None}, + ) + self.progress.update(table, table_size) # Mark table as done + return + forward_select = ( "SELECT rowid, * FROM %s WHERE rowid >= ? ORDER BY rowid LIMIT ?" % (table,) From 60a9a49f83f7ea7dc8f76ffaec17c9b42c3b19f7 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Thu, 20 Jul 2017 16:16:29 +0100 Subject: [PATCH 2/2] Extend comment --- scripts/synapse_port_db | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/synapse_port_db b/scripts/synapse_port_db index 8da8a3b1d2..bc167b59af 100755 --- a/scripts/synapse_port_db +++ b/scripts/synapse_port_db @@ -262,7 +262,8 @@ class Porter(object): return if table == "user_directory_stream_pos": - # We need to make sure there is a single row, `(X, null)` + # We need to make sure there is a single row, `(X, null), as that is + # what synapse expects to be there. yield self.postgres_store._simple_insert( table=table, values={"stream_id": None},