From 7f88b2f5a87972dcd7e84fa6109387283b18ce6e Mon Sep 17 00:00:00 2001 From: Matteo Campinoti Date: Mon, 5 Aug 2024 13:46:41 +0200 Subject: [PATCH 1/3] models.file:File - fix action_data validator for None values --- acacore/models/file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acacore/models/file.py b/acacore/models/file.py index 8608ad9..bd8d6e8 100644 --- a/acacore/models/file.py +++ b/acacore/models/file.py @@ -92,7 +92,7 @@ class File(BaseModel): root: Path | None = DBField(None, ignore=True) # noinspection PyNestedDecorators - @field_validator("action_data") + @field_validator("action_data", mode="before") @classmethod def _validate_action_data(cls, v: None | dict) -> dict: return {} if v is None else v From bd0d895f1d8bc3d7a49f97f04ddffd393cea764f Mon Sep 17 00:00:00 2001 From: Matteo Campinoti Date: Mon, 5 Aug 2024 13:47:10 +0200 Subject: [PATCH 2/3] database.upgrade:upgrade_1to2 - do not add lock column if already present --- acacore/database/upgrade.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/acacore/database/upgrade.py b/acacore/database/upgrade.py index 39dde3f..475ab0e 100644 --- a/acacore/database/upgrade.py +++ b/acacore/database/upgrade.py @@ -36,7 +36,8 @@ def get_upgrade_function(current_version: Version, latest_version: Version) -> C # noinspection SqlResolve def upgrade_1to2(db: FileDB) -> Version: - db.execute("alter table Files add column lock boolean default false") + if not db.execute("select 1 from pragma_table_info('Files') where name = 'lock'").fetchone(): + db.execute("alter table Files add column lock boolean default false") db.execute("update Files set lock = false where lock is null") db.execute("update Files set action = 'template' where action = 'replace'") for file in db.files.select(): From 3e9d1a5341f3e9368b96dbcaca55ff442878904d Mon Sep 17 00:00:00 2001 From: Matteo Campinoti Date: Mon, 5 Aug 2024 13:49:41 +0200 Subject: [PATCH 3/3] version - patch 2.0.0 > 2.0.1 --- acacore/__version__.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/acacore/__version__.py b/acacore/__version__.py index 8c0d5d5..159d48b 100644 --- a/acacore/__version__.py +++ b/acacore/__version__.py @@ -1 +1 @@ -__version__ = "2.0.0" +__version__ = "2.0.1" diff --git a/pyproject.toml b/pyproject.toml index 487410b..c6c1496 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "acacore" -version = "2.0.0" +version = "2.0.1" description = "" authors = ["Matteo Campinoti "] license = "GPL-3.0"