django-dbbackup icon indicating copy to clipboard operation
django-dbbackup copied to clipboard

Restore fail after editing DBBACKUP_FILENAME_TEMPLATE

Open EliasBoulharts opened this issue 3 years ago • 1 comments

Bug Report

Describe the bug

When I try to restore the database the command return CommandError: There's no backup file available. whereas the backup file was listed when I run listbackups.

To Reproduce

In setting file:

def backup_filename(databasename, servername, datetime, extension, content_type):
    return f"{content_type}-{datetime}.{extension}"

DBBACKUP_FILENAME_TEMPLATE = backup_filename
DBBACKUP_MEDIA_FILENAME_TEMPLATE = backup_filename

Expected behavior

Restore the .dump file no matter the name.

Workaround

Prefix the database file by database name.

def backup_filename(databasename, servername, datetime, extension, content_type):
    return f"{databasename}-{content_type}-{datetime}.{extension}"

Versions

Django-dbbackup

  • poetry: 3.3.0

External tools

  • Python: 3.9
  • Django: 3.2.12
  • OS: RockyLinux 8.5

EliasBoulharts avatar Apr 05 '22 13:04 EliasBoulharts

Hi, I'm going to be working on this issue in the next couple of days/weeks. Thanks

stan-levend avatar Oct 12 '22 12:10 stan-levend