Skip to content

Commit

Permalink
database.upgrade:upgrade_last - remove unneeded function
Browse files Browse the repository at this point in the history
Can use a lambda with the same behaviour
  • Loading branch information
MatteoCampinoti94 committed Aug 20, 2024
1 parent 35e8dcb commit 8334d38
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions acacore/database/upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,6 @@ def upgrade_3to3_0_2(conn: Connection) -> Version:
return set_db_version(conn, Version("3.0.2"))


def upgrade_last(conn: Connection) -> Version:
return set_db_version(conn, Version(__version__))


def get_upgrade_function(current_version: Version, latest_version: Version) -> Callable[[Connection], Version]:
if current_version < Version("2.0.0"):
return upgrade_1to2
Expand All @@ -162,7 +158,7 @@ def get_upgrade_function(current_version: Version, latest_version: Version) -> C
elif current_version < Version("3.0.2"):
return upgrade_3to3_0_2
elif current_version < latest_version:
return upgrade_last
return lambda c: set_db_version(c, Version(__version__))
else:
return lambda _: latest_version

Expand Down

0 comments on commit 8334d38

Please sign in to comment.