From a9ad647fb27aaa5085a828157f30627edfbe76aa Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Wed, 2 Sep 2015 11:11:11 +0100 Subject: Make port script handle empty sent_transactions table --- scripts/synapse_port_db | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'scripts/synapse_port_db') diff --git a/scripts/synapse_port_db b/scripts/synapse_port_db index e7ed4c309b..c02dff5ba4 100755 --- a/scripts/synapse_port_db +++ b/scripts/synapse_port_db @@ -412,14 +412,17 @@ class Porter(object): self._convert_rows("sent_transactions", headers, rows) inserted_rows = len(rows) - max_inserted_rowid = max(r[0] for r in rows) + if inserted_rows: + max_inserted_rowid = max(r[0] for r in rows) - def insert(txn): - self.postgres_store.insert_many_txn( - txn, "sent_transactions", headers[1:], rows - ) + def insert(txn): + self.postgres_store.insert_many_txn( + txn, "sent_transactions", headers[1:], rows + ) - yield self.postgres_store.execute(insert) + yield self.postgres_store.execute(insert) + else: + max_inserted_rowid = 0 def get_start_id(txn): txn.execute( -- cgit 1.5.1 From bdf2e5865a6c47b89dbcb11fb747cfc87c26fdbd Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Thu, 3 Sep 2015 09:51:42 +0300 Subject: update logger to match new ambiguous script name... --- scripts/synapse_port_db | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts/synapse_port_db') diff --git a/scripts/synapse_port_db b/scripts/synapse_port_db index e7ed4c309b..c241fdec5a 100755 --- a/scripts/synapse_port_db +++ b/scripts/synapse_port_db @@ -29,7 +29,7 @@ import traceback import yaml -logger = logging.getLogger("port_from_sqlite_to_postgres") +logger = logging.getLogger("synapse_port_db") BOOLEAN_COLUMNS = { -- cgit 1.5.1