def METHOD_NAME():
    if settings.DATABASE_BACKUP == "none":
        return
    with backup_lock():
        database = settings.DATABASES["default"]
        env = get_clean_env()
        compress = settings.DATABASE_BACKUP == "compressed"
        out_compressed = data_dir("backups", "database.sql.gz")
        out_text = data_dir("backups", "database.sql")
        if using_postgresql():
            cmd = ["pg_dump", "--dbname", database["NAME"]]
            if database["HOST"]:
                cmd.extend(["--host", database["HOST"]])
            if database["PORT"]:
                cmd.extend(["--port", database["PORT"]])
            if database["USER"]:
                cmd.extend(["--username", database["USER"]])
            if settings.DATABASE_BACKUP == "compressed":
                cmd.extend(["--file", out_compressed])
                cmd.extend(["--compress", "6"])
                compress = False
            else:
                cmd.extend(["--file", out_text])
            env["PGPASSWORD"] = database["PASSWORD"]
        else:
            cmd = [
                "mysqldump",
                "--result-file",
                out_text,
                "--single-transaction",
                "--skip-lock-tables",
            ]
            if database["HOST"]:
                cmd.extend(["--host", database["HOST"]])
            if database["PORT"]:
                cmd.extend(["--port", database["PORT"]])
            if database["USER"]:
                cmd.extend(["--user", database["USER"]])
            cmd.extend(["--databases", database["NAME"]])
            env["MYSQL_PWD"] = database["PASSWORD"]
        try:
            subprocess.run(
                cmd,
                env=env,
                capture_output=True,
                stdin=subprocess.DEVNULL,
                check=True,
                text=True,
            )
        except subprocess.CalledProcessError as error:
            add_breadcrumb(
                category="backup",
                message="database dump output",
                stdout=error.stdout,
                stderr=error.stderr,
            )
            report_error()
            raise
        if compress:
            with open(out_text, "rb") as f_in, gzip.open(out_compressed, "wb") as f_out:
                shutil.copyfileobj(f_in, f_out)
            os.unlink(out_text)