mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-12 10:05:39 +00:00
Add db an media backups (#3783)
* [FR] Add backup into inventrees lifecycle Fixes #3778 * Add env to testing enviros * block backup from running app commands * Add more commands * fix postgres version * Update used env * add daily task to run backups * add installer changes
This commit is contained in:
22
tasks.py
22
tasks.py
@ -196,7 +196,27 @@ def translate(c):
|
||||
manage(c, "compilemessages")
|
||||
|
||||
|
||||
@task(post=[rebuild_models, rebuild_thumbnails])
|
||||
@task
|
||||
def backup(c):
|
||||
"""Backup the database and media files."""
|
||||
|
||||
print("Backing up InvenTree database...")
|
||||
manage(c, "dbbackup --noinput --clean --compress")
|
||||
print("Backing up InvenTree media files...")
|
||||
manage(c, "mediabackup --noinput --clean --compress")
|
||||
|
||||
|
||||
@task
|
||||
def restore(c):
|
||||
"""Restore the database and media files."""
|
||||
|
||||
print("Restoring InvenTree database...")
|
||||
manage(c, "dbrestore --noinput --uncompress")
|
||||
print("Restoring InvenTree media files...")
|
||||
manage(c, "mediarestore --noinput --uncompress")
|
||||
|
||||
|
||||
@task(pre=[backup, ], post=[rebuild_models, rebuild_thumbnails])
|
||||
def migrate(c):
|
||||
"""Performs database migrations.
|
||||
|
||||
|
Reference in New Issue
Block a user