mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-10 19:46:36 +03:00
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:
parent
63ef7284f7
commit
52be689926
|
@ -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,))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user