from typing import List
from typing import Optional


def make_file_list(schema_name: str, migration_path: List[Optional[str]]):
    """Construct a list of file names from history of versions and schema name"""
    result = []
    for v1, v2 in zip(migration_path, migration_path[1:]):
        if v1 is None:
            name = "%s--%s.sql" % (schema_name, v2)
        else:
            name = "%s--%s--%s.sql" % (schema_name, v1, v2)
        result.append(name)
    return result