Stop writing the superseded flat room-in-roof columns 🟩

Since #1665 landed, the full room-in-roof geometry is stored in and reconstructed
from the epc_room_in_roof / epc_room_in_roof_surface child tables; the two flat
columns on epc_building_part (room_in_roof_floor_area,
room_in_roof_construction_age_band) are redundant duplicates that are written but
never read. Remove the two SQLModel fields and their from_domain writes so the
backend stops populating them — the required step BEFORE the FE migration drops
the columns (dropping them while a backend that still writes them is live would
500 every save).

Reconstruction already reads the child table (_to_room_in_roof), so the
round-trip gate stays a hard zero. The columns remain in the DB (nullable,
unwritten) until the FE drop migration runs.

Deploy AFTER #1674 is stable in every environment; the FE column drop runs after
this deploys everywhere.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Khalim Conn-Kowlessar 2026-07-23 10:15:11 +00:00
parent 11ea2c2077
commit 46358abcd1

View file

@ -685,8 +685,6 @@ class EpcBuildingPartModel(SQLModel, table=True):
# (-2.32 SAP). The prior allowlist "RdSAP uses defaults" was stale — the
# cascade does honour the lodged U on the API path.
wall_u_value: Optional[float] = Field(default=None)
room_in_roof_floor_area: Optional[float] = Field(default=None)
room_in_roof_construction_age_band: Optional[str] = Field(default=None)
alt_wall_1_area: Optional[float] = Field(default=None)
alt_wall_1_dry_lined: Optional[str] = Field(default=None)
alt_wall_1_construction: Optional[int] = Field(default=None)
@ -715,7 +713,6 @@ class EpcBuildingPartModel(SQLModel, table=True):
def from_domain(
cls, part: SapBuildingPart, epc_property_id: int
) -> EpcBuildingPartModel:
rir = part.sap_room_in_roof
aw1 = part.sap_alternative_wall_1
aw2 = part.sap_alternative_wall_2
return cls(
@ -746,10 +743,6 @@ class EpcBuildingPartModel(SQLModel, table=True):
rafter_insulation_thickness=part.rafter_insulation_thickness,
wall_is_basement=part.wall_is_basement,
wall_u_value=part.wall_u_value,
room_in_roof_floor_area=float(rir.floor_area) if rir else None,
room_in_roof_construction_age_band=(
rir.construction_age_band if rir else None
),
alt_wall_1_area=aw1.wall_area if aw1 else None,
alt_wall_1_dry_lined=aw1.wall_dry_lined if aw1 else None,
alt_wall_1_construction=aw1.wall_construction if aw1 else None,