3
2
forked from Dniel97/artemis

database: don't set schema version if autoupdate fails

This commit is contained in:
Hay1tsme 2023-04-15 03:13:14 -04:00
parent 4102ba21fc
commit 0dc96f33e1

View File

@ -293,7 +293,7 @@ class Data:
all_games_list[mod.game_codes[0]] = mod.current_schema_version all_games_list[mod.game_codes[0]] = mod.current_schema_version
for x in all_game_versions: for x in all_game_versions:
failed = False
game = x["game"].upper() game = x["game"].upper()
update_ver = int(x["version"]) update_ver = int(x["version"])
latest_ver = all_games_list.get(game, 1) latest_ver = all_games_list.get(game, 1)
@ -316,8 +316,10 @@ class Data:
result = self.base.execute(sql) result = self.base.execute(sql)
if result is None: if result is None:
self.logger.error(f"Error execuing sql script for game {game} v{y}!") self.logger.error(f"Error execuing sql script for game {game} v{y}!")
continue failed = True
break
else: else:
self.logger.warning(f"Could not find script {game}_{y}_upgrade.sql") 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)