From 46358abcd16848daaddb58cb313056e1ef5d22c9 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Thu, 23 Jul 2026 10:15:11 +0000 Subject: [PATCH] =?UTF-8?q?Stop=20writing=20the=20superseded=20flat=20room?= =?UTF-8?q?-in-roof=20columns=20=F0=9F=9F=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- infrastructure/postgres/epc_property_table.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/infrastructure/postgres/epc_property_table.py b/infrastructure/postgres/epc_property_table.py index 2cbe8c932..164b7b16b 100644 --- a/infrastructure/postgres/epc_property_table.py +++ b/infrastructure/postgres/epc_property_table.py @@ -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,