diff --git a/CHANGELOG.md b/CHANGELOG.md index d096239..1e7712a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,12 +5,6 @@ All notable changes to WuttaFarm will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## v0.4.1 (2026-02-17) - -### Fix - -- remove `AnimalType.changed` column - ## v0.4.0 (2026-02-17) ### Feat diff --git a/pyproject.toml b/pyproject.toml index 44bea43..12bce62 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "hatchling.build" [project] name = "WuttaFarm" -version = "0.4.1" +version = "0.4.0" description = "Web app to integrate with and extend farmOS" readme = "README.md" authors = [ diff --git a/src/wuttafarm/db/alembic/versions/b8cd4a8f981f_remove_animaltype_changed.py b/src/wuttafarm/db/alembic/versions/b8cd4a8f981f_remove_animaltype_changed.py deleted file mode 100644 index a43a6d4..0000000 --- a/src/wuttafarm/db/alembic/versions/b8cd4a8f981f_remove_animaltype_changed.py +++ /dev/null @@ -1,37 +0,0 @@ -"""remove AnimalType.changed - -Revision ID: b8cd4a8f981f -Revises: aecfd9175624 -Create Date: 2026-02-17 18:11:06.110003 - -""" - -from typing import Sequence, Union - -from alembic import op -import sqlalchemy as sa -import wuttjamaican.db.util -from sqlalchemy.dialects import postgresql - -# revision identifiers, used by Alembic. -revision: str = "b8cd4a8f981f" -down_revision: Union[str, None] = "aecfd9175624" -branch_labels: Union[str, Sequence[str], None] = None -depends_on: Union[str, Sequence[str], None] = None - - -def upgrade() -> None: - - # animal_type - op.drop_column("animal_type", "changed") - - -def downgrade() -> None: - - # animal_type - op.add_column( - "animal_type", - sa.Column( - "changed", postgresql.TIMESTAMP(), autoincrement=False, nullable=True - ), - ) diff --git a/src/wuttafarm/db/model/animals.py b/src/wuttafarm/db/model/animals.py index 8c0df35..548be86 100644 --- a/src/wuttafarm/db/model/animals.py +++ b/src/wuttafarm/db/model/animals.py @@ -37,7 +37,11 @@ class AnimalType(model.Base): """ __tablename__ = "animal_type" - __versioned__ = {} + __versioned__ = { + "exclude": [ + "changed", + ], + } __wutta_hint__ = { "model_title": "Animal Type", "model_title_plural": "Animal Types", @@ -62,6 +66,14 @@ class AnimalType(model.Base): """, ) + changed = sa.Column( + sa.DateTime(), + nullable=True, + doc=""" + When the animal type was last changed, according to farmOS. + """, + ) + farmos_uuid = sa.Column( model.UUID(), nullable=True, diff --git a/src/wuttafarm/importing/farmos.py b/src/wuttafarm/importing/farmos.py index b07d06d..4f9db20 100644 --- a/src/wuttafarm/importing/farmos.py +++ b/src/wuttafarm/importing/farmos.py @@ -412,6 +412,7 @@ class AnimalTypeImporter(FromFarmOS, ToWutta): "drupal_id", "name", "description", + "changed", ] def get_source_objects(self): @@ -426,6 +427,7 @@ class AnimalTypeImporter(FromFarmOS, ToWutta): "drupal_id": animal_type["attributes"]["drupal_internal__tid"], "name": animal_type["attributes"]["name"], "description": animal_type["attributes"]["description"], + "changed": self.normalize_datetime(animal_type["attributes"]["changed"]), } diff --git a/src/wuttafarm/web/views/animals.py b/src/wuttafarm/web/views/animals.py index 7016e36..bae7dde 100644 --- a/src/wuttafarm/web/views/animals.py +++ b/src/wuttafarm/web/views/animals.py @@ -45,6 +45,7 @@ class AnimalTypeView(AssetTypeMasterView): grid_columns = [ "name", "description", + "changed", ] sort_defaults = "name" @@ -56,6 +57,7 @@ class AnimalTypeView(AssetTypeMasterView): form_fields = [ "name", "description", + "changed", "farmos_uuid", "drupal_id", ]