Files
remnawave-bedolaga-telegram…/migrations/alembic/versions/0009_add_channel_id_index.py
T
Fringg 8375d7ecc5 feat: add multi-channel mandatory subscription system
- Multi-channel subscription enforcement via middleware, events, and cabinet API
- 3-layer cache architecture: Redis -> PostgreSQL -> rate-limited Telegram API
- ChatMemberUpdated event-driven tracking with automatic VPN access control
- Admin management via bot FSM handler and REST API with full CRUD
- Channel ID normalization: @username resolved to numeric ID at creation time
- Fail-closed error handling: API errors deny access (security-first)
- Background reconciliation with keyset pagination (100 per batch)
- Per-user rate limiting on subscription check button (5s cooldown)
- Redis connection pooling via cache singleton (no per-request connections)
- Database: channel_id index, multi-row upsert optimization
- Localization: en, ru, zh, fa, ua translations for all new strings
- Frontend blocking UI with channel list and subscription status
- Admin channel management page with toggle, delete, and create
2026-02-24 02:50:31 +03:00

29 lines
650 B
Python

"""add channel_id index for user_channel_subscriptions
Revision ID: 0009
Revises: 0008
Create Date: 2026-02-24
"""
from typing import Sequence, Union
from alembic import op
revision: str = '0009'
down_revision: Union[str, None] = '0008'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
op.create_index(
'ix_user_channel_sub_channel_id',
'user_channel_subscriptions',
['channel_id'],
if_not_exists=True,
)
def downgrade() -> None:
op.drop_index('ix_user_channel_sub_channel_id', table_name='user_channel_subscriptions')