Only upgrade database if version < current

Should deal more gracefully when using new
session files in older versions of the library.
This commit is contained in:
Lonami 2019-05-02 23:20:39 +02:00 committed by GitHub
parent 63ef7284f7
commit 52be689926
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -50,7 +50,7 @@ class SQLiteSession(MemorySession):
# Tables already exist, check for the version # Tables already exist, check for the version
c.execute("select version from version") c.execute("select version from version")
version = c.fetchone()[0] version = c.fetchone()[0]
if version != CURRENT_VERSION: if version < CURRENT_VERSION:
self._upgrade_database(old=version) self._upgrade_database(old=version)
c.execute("delete from version") c.execute("delete from version")
c.execute("insert into version values (?)", (CURRENT_VERSION,)) c.execute("insert into version values (?)", (CURRENT_VERSION,))