mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-05 20:50:22 +03:00
Merge branch 'master' into asyncio
This commit is contained in:
commit
9e7cbb0b09
2
setup.py
2
setup.py
|
@ -139,7 +139,7 @@ def main():
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# e.g. install from GitHub
|
# e.g. install from GitHub
|
||||||
if os.path.isfile(GENERATOR_DIR):
|
if os.path.isdir(GENERATOR_DIR):
|
||||||
generate(['tl', 'errors'])
|
generate(['tl', 'errors'])
|
||||||
|
|
||||||
# Get the long description from the README file
|
# Get the long description from the README file
|
||||||
|
|
|
@ -12,7 +12,7 @@ from ..tl.types import (
|
||||||
)
|
)
|
||||||
|
|
||||||
EXTENSION = '.session'
|
EXTENSION = '.session'
|
||||||
CURRENT_VERSION = 3 # database version
|
CURRENT_VERSION = 4 # database version
|
||||||
|
|
||||||
|
|
||||||
class SQLiteSession(MemorySession):
|
class SQLiteSession(MemorySession):
|
||||||
|
@ -93,6 +93,14 @@ class SQLiteSession(MemorySession):
|
||||||
hash integer,
|
hash integer,
|
||||||
primary key(md5_digest, file_size, type)
|
primary key(md5_digest, file_size, type)
|
||||||
)"""
|
)"""
|
||||||
|
,
|
||||||
|
"""update_state (
|
||||||
|
id integer primary key,
|
||||||
|
pts integer,
|
||||||
|
qts integer,
|
||||||
|
date integer,
|
||||||
|
seq integer
|
||||||
|
)"""
|
||||||
)
|
)
|
||||||
c.execute("insert into version values (?)", (CURRENT_VERSION,))
|
c.execute("insert into version values (?)", (CURRENT_VERSION,))
|
||||||
# Migrating from JSON -> new table and may have entities
|
# Migrating from JSON -> new table and may have entities
|
||||||
|
@ -135,18 +143,30 @@ class SQLiteSession(MemorySession):
|
||||||
|
|
||||||
def _upgrade_database(self, old):
|
def _upgrade_database(self, old):
|
||||||
c = self._cursor()
|
c = self._cursor()
|
||||||
# old == 1 doesn't have the old sent_files so no need to drop
|
if old == 1:
|
||||||
|
old += 1
|
||||||
|
# old == 1 doesn't have the old sent_files so no need to drop
|
||||||
if old == 2:
|
if old == 2:
|
||||||
|
old += 1
|
||||||
# Old cache from old sent_files lasts then a day anyway, drop
|
# Old cache from old sent_files lasts then a day anyway, drop
|
||||||
c.execute('drop table sent_files')
|
c.execute('drop table sent_files')
|
||||||
self._create_table(c, """sent_files (
|
self._create_table(c, """sent_files (
|
||||||
md5_digest blob,
|
md5_digest blob,
|
||||||
file_size integer,
|
file_size integer,
|
||||||
type integer,
|
type integer,
|
||||||
id integer,
|
id integer,
|
||||||
hash integer,
|
hash integer,
|
||||||
primary key(md5_digest, file_size, type)
|
primary key(md5_digest, file_size, type)
|
||||||
)""")
|
)""")
|
||||||
|
if old == 3:
|
||||||
|
old += 1
|
||||||
|
self._create_table(c, """update_state (
|
||||||
|
id integer primary key,
|
||||||
|
pts integer,
|
||||||
|
qts integer,
|
||||||
|
date integer,
|
||||||
|
seq integer
|
||||||
|
)""")
|
||||||
c.close()
|
c.close()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
Loading…
Reference in New Issue
Block a user