from pathlib import Path


def test_ccdi_account_info_should_have_incremental_migration_for_abnormal_account_columns():
    project_root = Path(__file__).resolve().parents[2]
    migration_path = (
        project_root
        / "sql"
        / "migration"
        / "2026-04-15-sync-ccdi-account-info-abnormal-account-columns.sql"
    )

    assert migration_path.exists(), "缺少 ccdi_account_info 异常账户字段补迁移脚本"

    sql = migration_path.read_text(encoding="utf-8")

    assert "information_schema.columns" in sql
    assert "ALTER TABLE `ccdi_account_info` ADD COLUMN `is_self_account`" in sql
    assert "ALTER TABLE `ccdi_account_info` ADD COLUMN `trans_risk_level`" in sql
