From f3550ca817a87bb11d5577cc3555f3740ebf7aa0 Mon Sep 17 00:00:00 2001 From: Andrew Date: Thu, 2 Jan 2025 14:35:01 -0500 Subject: [PATCH] Fix backup migration running twice. --- app/migrations/20240308_multi-backup.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/migrations/20240308_multi-backup.py b/app/migrations/20240308_multi-backup.py index 64ff03e1..f8bd7439 100644 --- a/app/migrations/20240308_multi-backup.py +++ b/app/migrations/20240308_multi-backup.py @@ -8,7 +8,7 @@ import logging from app.classes.shared.helpers import Helpers from app.classes.shared.console import Console -from app.classes.shared.migration import Migrator +from app.classes.shared.migration import Migrator, MigrateHistory from app.classes.shared.file_helpers import FileHelpers logger = logging.getLogger(__name__) @@ -25,6 +25,12 @@ def migrate(migrator: Migrator, database, **kwargs): """ Write your migrations here. """ + this_migration = MigrateHistory.get_or_none( + MigrateHistory.name == "20240308_multi-backup" + ) + if this_migration is not None: + Console.debug("Update database already done, skipping this part") + return backup_migration_status = True schedule_migration_status = True db = database