fix: remove AnimalType.changed column
that was just confusing things. WuttaFarm model should have its own notion of when things changed, and farmOS can have its own.
This commit is contained in:
parent
d741a88299
commit
e520a34fa5
4 changed files with 38 additions and 17 deletions
|
|
@ -0,0 +1,37 @@
|
|||
"""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
|
||||
),
|
||||
)
|
||||
|
|
@ -37,11 +37,7 @@ class AnimalType(model.Base):
|
|||
"""
|
||||
|
||||
__tablename__ = "animal_type"
|
||||
__versioned__ = {
|
||||
"exclude": [
|
||||
"changed",
|
||||
],
|
||||
}
|
||||
__versioned__ = {}
|
||||
__wutta_hint__ = {
|
||||
"model_title": "Animal Type",
|
||||
"model_title_plural": "Animal Types",
|
||||
|
|
@ -66,14 +62,6 @@ 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,
|
||||
|
|
|
|||
|
|
@ -412,7 +412,6 @@ class AnimalTypeImporter(FromFarmOS, ToWutta):
|
|||
"drupal_id",
|
||||
"name",
|
||||
"description",
|
||||
"changed",
|
||||
]
|
||||
|
||||
def get_source_objects(self):
|
||||
|
|
@ -427,7 +426,6 @@ 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"]),
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,6 @@ class AnimalTypeView(AssetTypeMasterView):
|
|||
grid_columns = [
|
||||
"name",
|
||||
"description",
|
||||
"changed",
|
||||
]
|
||||
|
||||
sort_defaults = "name"
|
||||
|
|
@ -57,7 +56,6 @@ class AnimalTypeView(AssetTypeMasterView):
|
|||
form_fields = [
|
||||
"name",
|
||||
"description",
|
||||
"changed",
|
||||
"farmos_uuid",
|
||||
"drupal_id",
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue