Дополнение. Индексация по полю user_id

master
ssleg 2021-12-23 09:49:03 +03:00
parent 81fd61ea0a
commit c4057a3525
Signed by: anton
GPG Key ID: 50F7E97F96C07ECF
1 changed files with 6 additions and 4 deletions

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# Telegram chat reader v1.01 # Telegram chat reader v1.02
# 22/12/2021 # 23/12/2021
# https://t.me/ssleg © 2021 # https://t.me/ssleg © 2021
@ -184,7 +184,6 @@ def check_config():
password=database_pass, password=database_pass,
host=database_host, host=database_host,
port=database_port) port=database_port)
valid_db = True
cursor = con.cursor() cursor = con.cursor()
cursor.execute(''' cursor.execute('''
create table if not exists chat_reader_users create table if not exists chat_reader_users
@ -237,9 +236,12 @@ def check_config():
constraint chat_reader_pk constraint chat_reader_pk
primary key (chat_id, message_id) primary key (chat_id, message_id)
); );
create index if not exists chat_reader_mess_user_id on chat_reader_mess (user_id);
''') ''')
con.commit() con.commit()
con.close() con.close()
valid_db = True
except Exception as e: except Exception as e:
print(e) print(e)
@ -249,8 +251,8 @@ def check_config():
client = TelegramClient('chat_reader', api_id, api_hash) client = TelegramClient('chat_reader', api_id, api_hash)
client.start() client.start()
print(f'версия telethon {client.__version__}') print(f'версия telethon {client.__version__}')
valid_client = True
client.disconnect() client.disconnect()
valid_client = True
except Exception as e: except Exception as e:
print(e) print(e)