From b5e57e80e975fff7b9cf6933bfa7ae6334ffe163 Mon Sep 17 00:00:00 2001 From: def Date: Mon, 9 Jan 2023 01:13:27 +0300 Subject: [PATCH] add telegram_users table --- mirrortea/__main__.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/mirrortea/__main__.py b/mirrortea/__main__.py index 5fe98dc..8904c06 100644 --- a/mirrortea/__main__.py +++ b/mirrortea/__main__.py @@ -13,9 +13,20 @@ CREATE TABLE IF NOT EXISTS telegram_user_matrix_chats ( matrix_chat_id INTEGER NOT NULL, FOREIGN KEY(telegram_user_id) REFERENCES telegram_users(id), FOREIGN KEY(matrix_chat_id) REFERENCES matrix_chats(id) -) +); ''' +TELEGRAM_USERS_SQL = ''' +CREATE TABLE IF NOT EXISTS telegram_users +( + id INTEGER PRIMARY KEY NOT NULL CHECK(id < 15), + first_name TEXT NOT NULL CHECK(first_name < 50), + last_name TEXT CHECK(last_name < 50, + username TEXT CHECK(username < 50), +); +''' + + def main(): config = Config( db_path=os.environ['DB_PATH'],