Skip to content

Commit

Permalink
fix horrible untested multiple schema version update logic
Browse files Browse the repository at this point in the history
  • Loading branch information
pedohorse committed Jul 24, 2024
1 parent 7cfb06c commit 404ebf1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lifeblood/scheduler/data_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,10 +461,10 @@ def __database_schema_upgrade(self, con: sqlite3.Connection, from_version: int,
raise NotImplementedError(f"Don't know how to update db schema from v{from_version} to v{to_version}")
if to_version < from_version:
raise ValueError(f'to_version cannot be less than from_version ({to_version}<{from_version})')
if from_version - to_version > 1:
if to_version - from_version > 1:
need_commit = False
for i in range(from_version, to_version):
need_commit = self.__database_schema_upgrade(con, from_version, from_version + 1) or need_commit
need_commit = self.__database_schema_upgrade(con, i, i + 1) or need_commit
return need_commit

# at this point we are sure that from_version +1 = to_version
Expand Down

0 comments on commit 404ebf1

Please sign in to comment.