fix: webapp accesability when tg is unreachable
This commit is contained in:
@@ -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,
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user