Files
duty-teller/alembic/versions/004_group_duty_pins_and_user_phone.py
Nikolay Tatarinov 50347038e9 Implement group duty pinning and user phone management
- Added functionality to pin duty messages in group chats, including scheduling updates and handling bot add/remove events.
- Introduced a new `GroupDutyPin` model to store pinned message details and a `phone` field in the `User` model for user contact information.
- Implemented commands for users to set or clear their phone numbers in private chats.
- Enhanced the repository with functions to manage group duty pins and user phone data.
- Updated handlers to register new commands and manage duty pin updates effectively.
2026-02-18 01:00:31 +03:00

36 lines
798 B
Python

"""Group duty pins table and User.phone
Revision ID: 004
Revises: 003
Create Date: 2025-02-18
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
revision: str = "004"
down_revision: Union[str, None] = "003"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
op.add_column(
"users",
sa.Column("phone", sa.Text(), nullable=True),
)
op.create_table(
"group_duty_pins",
sa.Column("chat_id", sa.BigInteger(), nullable=False),
sa.Column("message_id", sa.Integer(), nullable=False),
sa.PrimaryKeyConstraint("chat_id"),
)
def downgrade() -> None:
op.drop_table("group_duty_pins")
op.drop_column("users", "phone")