better printing for alias migration script
This commit is contained in:
parent
dd3d72d8d3
commit
8eb26a5bd2
1 changed files with 5 additions and 2 deletions
|
@ -14,12 +14,15 @@ cursor.execute(
|
||||||
"""SELECT server_id, value FROM server_settings
|
"""SELECT server_id, value FROM server_settings
|
||||||
WHERE setting='command-aliases'""")
|
WHERE setting='command-aliases'""")
|
||||||
results = cursor.fetchall()
|
results = cursor.fetchall()
|
||||||
print(results)
|
|
||||||
|
cursor.execute("SELECT server_id, alias FROM servers")
|
||||||
|
servers = dict(cursor.fetchall())
|
||||||
|
|
||||||
for server_id, value in results:
|
for server_id, value in results:
|
||||||
aliases = json.loads(value)
|
aliases = json.loads(value)
|
||||||
for alias, command in aliases.items():
|
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 (?, ?, ?)",
|
cursor.execute("INSERT INTO server_settings VALUES (?, ?, ?)",
|
||||||
[server_id, "alias-%s" % alias, json.dumps(command)])
|
[server_id, "alias-%s" % alias, json.dumps(command)])
|
||||||
database.commit()
|
database.commit()
|
||||||
|
|
Loading…
Reference in a new issue