ttrss: fix failing backup

Closes: #2206

Use pg_dumpall instead of pg_dump.

Test I did:
1. Install tt-rss and add a feed
2. Create a backup
3. On a fresh installation restore the backup from file

Signed-off-by: nbenedek <contact@nbenedek.me>
[jvalleroy: Add a comment about the limitation of this approach]
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
nbenedek 2023-03-07 23:37:31 +01:00 committed by James Valleroy
parent e974ac735a
commit bf2e53f323
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -113,7 +113,10 @@ def dump_database():
"""Dump database to file."""
os.makedirs(os.path.dirname(DB_BACKUP_FILE), exist_ok=True)
with open(DB_BACKUP_FILE, 'w', encoding='utf-8') as db_backup_file:
_run_as_postgres(['pg_dump', 'ttrss'], stdout=db_backup_file)
# XXX: Currently, ttrss is the only app that uses
# PostgreSQL. If another app was using it, then its data would
# be included in the backup here.
_run_as_postgres(['pg_dumpall'], stdout=db_backup_file)
@privileged