Skip to content

dbbackup --clean not working #641

@oliverbienert

Description

@oliverbienert

Current Situation

The commandline switch -c/--clean does not work when issueing a backup:

python manage.py dbbackup -c -q -z.

Nothing get deleted. Setting DBBACKUP_CLEANUP_KEEP to another value (e.g. 5) does not help.
However, issueing a media backup:

python manage.py mediabackup -c -q -z

works as expected, only the last 10 files are being kept.
Here are my filename templates:

DBBACKUP_FILENAME_TEMPLATE = "db-{datetime}.{extension}"
DBBACKUP_MEDIA_FILENAME_TEMPLATE = "media-{datetime}.{extension}"

Tested with version 4.3 and 5.0.

The logs do not help:

2025-10-09 14:53:18,102 dbbackup.command INFO     Backing Up Database: bze3_portal_dev
2025-10-09 14:53:18,102 dbbackup.command DEBUG     pg_dump --dbname=postgresql://postgres@localhost/bze3_portal_dev --format=custom 
2025-10-09 14:53:18,208 dbbackup.command DEBUG    Backup size: 115.6 KiB
2025-10-09 14:53:18,208 dbbackup.command INFO     Writing file to db-2025-10-09-145318.psql.bin.gz

Proposed Actions

No response

System Information

Occurs on both my development and my production system: Ubuntu 24.04
Django 5.2.1
Postgresql 16

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions