"""Doris migration: drop deprecated account_id, assigned_at from telegram_channels warehouse.

These columns are replaced by the ``channel_accounts`` junction table.
The warehouse table no longer needs these columns since assignment data
lives in the junction.
"""

from __future__ import annotations

from repo_core.migrations.builder import MigrationBuilder
from repo_core.migrations.runner import Migration

VERSION = "0005"


def get_doris_migrations() -> list[Migration]:
    """Return ordered Doris migrations."""
    return [

        Migration(
            version="telegram_channels_drop_deprecated_0005",
            description=(
                "Drop account_id, assigned_at columns from Doris "
                "telegram_channels warehouse — replaced by channel_accounts junction"
            ),
            up=(
                MigrationBuilder("telegram_channels", dialect="doris")
                .drop_column("account_id")
                .drop_column("assigned_at")
                .alter_table()
            ),
            down=(
                MigrationBuilder("telegram_channels", dialect="doris")
                .add_column("account_id", "UUID", nullable=True)
                .add_column("assigned_at", "TIMESTAMP", nullable=True)
                .alter_table()
            ),
        ),

    ]
