Better status reports from the DatabaseUpdate.

This commit is contained in:
Fabian Schlenz 2018-04-14 15:01:54 +02:00
parent 6d4701189b
commit 6b9cc9533a
1 changed files with 4 additions and 1 deletions

View File

@ -463,10 +463,12 @@ internal class DB_Update_11(conn: Connection, db: Database) : DatabaseUpdate(con
execute("ALTER TABLE messages ADD COLUMN json TEXT NULL") execute("ALTER TABLE messages ADD COLUMN json TEXT NULL")
execute("ALTER TABLE chats ADD COLUMN json TEXT NULL, api_layer INTEGER NULL") execute("ALTER TABLE chats ADD COLUMN json TEXT NULL, api_layer INTEGER NULL")
execute("ALTER TABLE users ADD COLUMN json TEXT NULL, api_layer INTEGER NULL") execute("ALTER TABLE users ADD COLUMN json TEXT NULL, api_layer INTEGER NULL")
val limit = 5000 val limit = 1000
var offset = 0 var offset = 0
var i = 0 var i = 0
val ps = conn.prepareStatement("UPDATE messages SET json=? WHERE id=?") val ps = conn.prepareStatement("UPDATE messages SET json=? WHERE id=?")
println(" Updating messages to add their JSON representation to the database. This might take a few moments...")
print(" ")
do { do {
i = 0 i = 0
logger.debug("Querying with limit $limit and offset $offset") logger.debug("Querying with limit $limit and offset $offset")
@ -490,6 +492,7 @@ internal class DB_Update_11(conn: Connection, db: Database) : DatabaseUpdate(con
print(".") print(".")
} while (i >= limit) } while (i >= limit)
println()
ps.close() ps.close()
} }
} }