Skip to content

Commit

Permalink
database.upgrade:upgrade_3_3to3_3_1 - add function to fix incorrect c…
Browse files Browse the repository at this point in the history
…olumn name in previous version of `upgrade_3_2to3_3`
  • Loading branch information
MatteoCampinoti94 committed Oct 29, 2024
1 parent 03af4a4 commit e3030fb
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions acacore/database/upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,14 @@ def _find_original_name(uuid: str, relative_path: str) -> str:
return set_db_version(conn, Version("3.3.0"))


# noinspection SqlResolve
def upgrade_3_3to3_3_1(conn: Connection) -> Version:
if conn.execute("select 1 from pragma_table_info('Files') where name = 'processed_name'").fetchone():
conn.execute("alter table Files rename column processed_name to processed_names")

return set_db_version(conn, Version("3.3.1"))


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 @@ -301,6 +309,8 @@ def get_upgrade_function(current_version: Version, latest_version: Version) -> C
return upgrade_3_1to3_2
elif current_version < Version("3.3.0"):
return upgrade_3_2to3_3
elif current_version < Version("3.3.1"):
return upgrade_3_3to3_3_1
elif current_version < latest_version:
return lambda c: set_db_version(c, Version(__version__))
else:
Expand Down

0 comments on commit e3030fb

Please sign in to comment.