def METHOD_NAME(file: Path):
    """Dump 'packit' database into a file.
    To restore db from this file, run:
    psql -d packit < database_packit.sql
    Args:
        file: File where to put the dump.
    Raises:
        PackitCommandFailedError: When pg_dump fails.
    """
    # We have to specify libpq connection string to be able to pass the
    # password to the pg_dump. Luckily get_pg_url() does almost what we need.
    pg_connection = get_pg_url().replace("+psycopg2", "")
    cmd = ["pg_dump", f"--file={file}", f"--dbname={pg_connection}"]
    packit_logger = getLogger("packit")
    was_debug = packit_logger.level == DEBUG
    logger.info(f"Running pg_dump to create '{DB_NAME}' database backup")
    try:
        if was_debug:
            # Temporarily increase log level to avoid password leaking into logs
            packit_logger.setLevel(INFO)
        run_command(cmd=cmd)
    finally:
        if was_debug:
            packit_logger.setLevel(DEBUG)