"""Migration registry — thin wrapper around auto-discovery.

Version files live in ``migrations/versions/postgres/`` (PostgreSQL) and
``migrations/versions/doris/`` (Doris warehouse).  They are discovered
automatically in lexicographic filename order within each dialect folder.
Use :func:`get_postgres_migrations` and :func:`get_doris_migrations` as
before — they now delegate to :func:`~repo_core.migrations.discovery.discover_migrations`.
"""

from __future__ import annotations

from repo_core.migrations.runner import Migration


def get_postgres_migrations() -> list[Migration]:
    """Return all PostgreSQL migrations from all version files, in order."""
    from repo_core.migrations.discovery import discover_migrations
    return discover_migrations("postgresql")


def get_doris_migrations() -> list[Migration]:
    """Return all Doris warehouse migrations from all version files, in order."""
    from repo_core.migrations.discovery import discover_migrations
    return discover_migrations("doris")


def get_postgres_migrations_up_to(version_file: str) -> list[Migration]:
    """Return PostgreSQL migrations up to and including *version_file* (e.g. "0002")."""
    from repo_core.migrations.discovery import discover_migrations
    return discover_migrations("postgresql", up_to_file=version_file)


def get_doris_migrations_up_to(version_file: str) -> list[Migration]:
    """Return Doris migrations up to and including *version_file*."""
    from repo_core.migrations.discovery import discover_migrations
    return discover_migrations("doris", up_to_file=version_file)
