from __future__ import annotations

from pathlib import Path


def test_drop_display_name_migration_exists_and_uses_username_metadata() -> None:
    versions_dir = Path(__file__).resolve().parents[3] / "alembic" / "versions"
    migration = (
        versions_dir / "20260224_drop_profile_display_name_and_trigger_username.py"
    )

    assert migration.exists()

    content = migration.read_text(encoding="utf-8")
    assert "DROP COLUMN" in content and "display_name" in content
    assert "raw_user_meta_data->>'username'" in content
