Skip to content

Commit

Permalink
database.upgrade:upgrade_2to2_0_2 - add upgrade function from 2.0.x t…
Browse files Browse the repository at this point in the history
…o 2.0.2
  • Loading branch information
MatteoCampinoti94 committed Aug 6, 2024
1 parent faae3b5 commit eeb3598
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions acacore/database/upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ def set_db_version(db: FileDB, version: Version) -> Version:
def get_upgrade_function(current_version: Version, latest_version: Version) -> Callable[[FileDB], Version]:
if current_version < Version("2.0.0"):
return upgrade_1to2
elif current_version < Version("2.0.2"):
return upgrade_2to2_0_2
elif current_version < latest_version:
return upgrade_last
else:
Expand All @@ -51,6 +53,12 @@ def upgrade_1to2(db: FileDB) -> Version:
return set_db_version(db, Version("2.0.0"))


def upgrade_2to2_0_2(db: FileDB) -> Version:
db.execute("drop view if exists _IdentificationWarnings")
db.identification_warnings.create()
return set_db_version(db, Version("2.0.2"))


def upgrade_last(db: FileDB) -> Version:
db.init()
return set_db_version(db, Version(__version__))
Expand Down

0 comments on commit eeb3598

Please sign in to comment.