From 0dc96f33e110ce69c0495e29b0898ee59578c465 Mon Sep 17 00:00:00 2001 From: Kevin Trocolli Date: Sat, 15 Apr 2023 03:13:14 -0400 Subject: [PATCH] database: don't set schema version if autoupdate fails --- core/data/database.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/data/database.py b/core/data/database.py index bcfcb1c..40bbf33 100644 --- a/core/data/database.py +++ b/core/data/database.py @@ -293,7 +293,7 @@ class Data: all_games_list[mod.game_codes[0]] = mod.current_schema_version for x in all_game_versions: - + failed = False game = x["game"].upper() update_ver = int(x["version"]) latest_ver = all_games_list.get(game, 1) @@ -316,8 +316,10 @@ class Data: result = self.base.execute(sql) if result is None: self.logger.error(f"Error execuing sql script for game {game} v{y}!") - continue + failed = True + break else: self.logger.warning(f"Could not find script {game}_{y}_upgrade.sql") + failed = True - self.base.set_schema_ver(latest_ver, game) + if not failed: self.base.set_schema_ver(latest_ver, game)