fix: webapp accesability when tg is unreachable

This commit is contained in:
3252a8
2026-05-06 21:39:11 +03:00
parent ca8df10eab
commit 8783129c16
11 changed files with 743 additions and 64 deletions
+30
View File
@@ -303,6 +303,31 @@ def _migration_0010_add_email_magic_token_hash(connection: Connection) -> None:
)
def _migration_0011_add_user_telegram_avatars(connection: Connection) -> None:
connection.execute(
text(
"""
CREATE TABLE IF NOT EXISTS user_telegram_avatars (
user_id BIGINT PRIMARY KEY REFERENCES users(user_id),
file_unique_id VARCHAR,
content_type VARCHAR(64) NOT NULL DEFAULT 'image/jpeg',
image_bytes BYTEA NOT NULL,
size_bytes INTEGER NOT NULL,
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
)
"""
)
)
connection.execute(
text(
"""
CREATE INDEX IF NOT EXISTS ix_user_telegram_avatars_file_unique_id
ON user_telegram_avatars (file_unique_id)
"""
)
)
def _migration_0009_add_composite_indexes(connection: Connection) -> None:
connection.execute(
text(
@@ -381,6 +406,11 @@ MIGRATIONS: List[Migration] = [
description="Store hashed magic-link tokens for email login deeplinks",
upgrade=_migration_0010_add_email_magic_token_hash,
),
Migration(
id="0011_add_user_telegram_avatars",
description="Cache compact Telegram profile avatars for WebApp profiles",
upgrade=_migration_0011_add_user_telegram_avatars,
),
]