import re


def extractMigrationInformation(filename: str, direction: str):
    """Extract the version from a filename e.g. V1.0.3.up.sql -> V1.0.3"""
    match = re.search("(?P<version>[^_]*)_?(?P<description>.*)\." + direction + "\.sql", filename, re.IGNORECASE)
    if not match:
        return {'version': None, 'description': None}
    return {'version': match.group('version'), 'description': match.group('description')}