Fixed crash on database upgrade.

This commit is contained in:
Felix Ableitner 2016-07-17 17:51:36 +02:00
parent 343c5fca07
commit 6bebfcf3cf

View file

@ -105,6 +105,7 @@ class Database(path: File, settings: SettingsInterface, callbackInterface: Callb
return return
logger.info(s"Upgrading database from version $oldVersion to $DatabaseVersion") logger.info(s"Upgrading database from version $oldVersion to $DatabaseVersion")
Class.forName("org.h2.Driver")
val connection = DriverManager.getConnection(DatabasePath) val connection = DriverManager.getConnection(DatabasePath)
if (oldVersion <= 2) { if (oldVersion <= 2) {
connection.createStatement().executeUpdate("ALTER TABLE MESSAGES ADD COLUMN (tokens INT);") connection.createStatement().executeUpdate("ALTER TABLE MESSAGES ADD COLUMN (tokens INT);")