From 8eb26a5bd2569aab30f1b304320992c53438583c Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 20 Nov 2019 11:57:38 +0000 Subject: [PATCH] better printing for alias migration script --- migration/v01.16.00-aliases.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/migration/v01.16.00-aliases.py b/migration/v01.16.00-aliases.py index ec0dd2cc..17cc9a2c 100644 --- a/migration/v01.16.00-aliases.py +++ b/migration/v01.16.00-aliases.py @@ -14,12 +14,15 @@ cursor.execute( """SELECT server_id, value FROM server_settings WHERE setting='command-aliases'""") results = cursor.fetchall() -print(results) + +cursor.execute("SELECT server_id, alias FROM servers") +servers = dict(cursor.fetchall()) for server_id, value in results: aliases = json.loads(value) for alias, command in aliases.items(): - print(server_id, alias, command) + print("[%s] Migrating '%s' ('%s')" % + (servers[server_id], alias, command)) cursor.execute("INSERT INTO server_settings VALUES (?, ?, ?)", [server_id, "alias-%s" % alias, json.dumps(command)]) database.commit()