Skip to content

Commit

Permalink
Merge branch 'main' into dev-matca
Browse files Browse the repository at this point in the history
  • Loading branch information
MatteoCampinoti94 committed Oct 29, 2024
2 parents e8843c0 + 5ba4638 commit 7d484ad
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion acacore/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "3.3.0"
__version__ = "3.3.1"
14 changes: 12 additions & 2 deletions acacore/database/upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@ def convert_action_data(data: dict) -> dict:
def upgrade_3_2to3_3(conn: Connection) -> Version:
if not conn.execute("select 1 from pragma_table_info('Files') where name = 'original_name'").fetchone():
conn.execute("alter table Files add column original_name text not null default ''")
if not conn.execute("select 1 from pragma_table_info('Files') where name = 'processed_name'").fetchone():
conn.execute("alter table Files add column processed_name text default '[]'")
if not conn.execute("select 1 from pragma_table_info('Files') where name = 'processed_names'").fetchone():
conn.execute("alter table Files add column processed_names text default '[]'")

def _find_original_name(uuid: str, relative_path: str) -> str:
original_path: Path = Path(relative_path)
Expand Down Expand Up @@ -287,6 +287,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 @@ -304,6 +312,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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "acacore"
version = "3.3.0"
version = "3.3.1"
description = ""
authors = ["Matteo Campinoti <[email protected]>"]
license = "GPL-3.0"
Expand Down

0 comments on commit 7d484ad

Please sign in to comment.