Merge pull request #331 from Hestia-Homes/feature/epc-calculator-read-fields-schema

feat(epc): persist 7 calculator-read fields dropped on save
This commit is contained in:
KhalimCK 2026-06-26 19:37:49 +01:00 committed by GitHub
commit 4ae4487055
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 11662 additions and 0 deletions

View file

@ -0,0 +1,8 @@
ALTER TABLE "epc_building_part" ADD COLUMN "wall_insulation_thermal_conductivity" jsonb;--> statement-breakpoint
ALTER TABLE "epc_building_part" ADD COLUMN "alt_wall_1_is_sheltered" boolean;--> statement-breakpoint
ALTER TABLE "epc_building_part" ADD COLUMN "alt_wall_2_is_sheltered" boolean;--> statement-breakpoint
ALTER TABLE "epc_main_heating_detail" ADD COLUMN "community_heating_boiler_fuel_type" integer;--> statement-breakpoint
ALTER TABLE "epc_main_heating_detail" ADD COLUMN "community_heating_chp_fraction" real;--> statement-breakpoint
ALTER TABLE "epc_property" ADD COLUMN "energy_pv_diverter_present" boolean DEFAULT false NOT NULL;--> statement-breakpoint
ALTER TABLE "epc_property" ADD COLUMN "heating_cylinder_volume_measured_l" integer;--> statement-breakpoint
ALTER TABLE "epc_property" ADD COLUMN "ventilation_air_permeability_ap50_m3_h_m2" real;

File diff suppressed because it is too large Load diff

View file

@ -1716,6 +1716,13 @@
"when": 1782491854452,
"tag": "0245_magenta_nomad",
"breakpoints": true
},
{
"idx": 246,
"version": "7",
"when": 1782498864047,
"tag": "0246_minor_lady_bullseye",
"breakpoints": true
}
]
}

View file

@ -539,6 +539,7 @@ export const epcProperty = pgTable(
energyPvBatteryCapacity: real("energy_pv_battery_capacity"),
energyWindTurbineHubHeight: real("energy_wind_turbine_hub_height"),
energyWindTurbineRotorDiameter: real("energy_wind_turbine_rotor_diameter"),
energyPvDiverterPresent: boolean("energy_pv_diverter_present").notNull().default(false),
// Heating config
heatingCylinderSize: jsonb("heating_cylinder_size"),
@ -550,6 +551,7 @@ export const epcProperty = pgTable(
heatingSecondaryFuelType: integer("heating_secondary_fuel_type"),
heatingSecondaryHeatingType: jsonb("heating_secondary_heating_type"),
heatingCylinderInsulationThicknessMm: integer("heating_cylinder_insulation_thickness_mm"),
heatingCylinderVolumeMeasuredL: integer("heating_cylinder_volume_measured_l"), // litres, nullable
heatingWwhrsIndexNumber1: integer("heating_wwhrs_index_number_1"),
heatingWwhrsIndexNumber2: integer("heating_wwhrs_index_number_2"),
heatingShowerOutletType: jsonb("heating_shower_outlet_type"),
@ -593,6 +595,7 @@ export const epcProperty = pgTable(
ventilationSuspendedTimberFloorSealed: boolean("ventilation_suspended_timber_floor_sealed"),
ventilationHasDraughtLobby: boolean("ventilation_has_draught_lobby"),
ventilationAirPermeabilityAp4M3HM2: real("ventilation_air_permeability_ap4_m3_h_m2"),
ventilationAirPermeabilityAp50M3HM2: real("ventilation_air_permeability_ap50_m3_h_m2"), // m³/h·m² @50Pa, nullable
ventilationMechanicalVentilationKind: text("ventilation_mechanical_ventilation_kind"),
},
(table) => [
@ -693,6 +696,8 @@ export const epcMainHeatingDetail = pgTable(
mainHeatingDataSource: integer("main_heating_data_source"),
condensing: boolean("condensing"),
weatherCompensator: boolean("weather_compensator"),
communityHeatingBoilerFuelType: integer("community_heating_boiler_fuel_type"), // SAP fuel code, nullable
communityHeatingChpFraction: real("community_heating_chp_fraction"), // 0..1 fraction, nullable
},
);
@ -718,6 +723,9 @@ export const epcBuildingPart = pgTable(
wallDryLined: boolean("wall_dry_lined"),
wallThicknessMm: integer("wall_thickness_mm"),
wallInsulationThickness: jsonb("wall_insulation_thickness"),
// Union[int,str] SAP code — JSONB to preserve int-vs-str on round-trip,
// matching wall_insulation_thickness / roof_insulation_thickness.
wallInsulationThermalConductivity: jsonb("wall_insulation_thermal_conductivity"), // nullable
// age band source
// Floor
@ -748,6 +756,7 @@ export const epcBuildingPart = pgTable(
altWall1InsulationType: integer("alt_wall_1_insulation_type"),
altWall1ThicknessMeasured: text("alt_wall_1_thickness_measured"),
altWall1InsulationThickness: text("alt_wall_1_insulation_thickness"),
altWall1IsSheltered: boolean("alt_wall_1_is_sheltered"), // nullable (null when no alt wall)
// Alternative wall 2 (inlined)
altWall2Area: real("alt_wall_2_area"),
@ -756,6 +765,7 @@ export const epcBuildingPart = pgTable(
altWall2InsulationType: integer("alt_wall_2_insulation_type"),
altWall2ThicknessMeasured: text("alt_wall_2_thickness_measured"),
altWall2InsulationThickness: text("alt_wall_2_insulation_thickness"),
altWall2IsSheltered: boolean("alt_wall_2_is_sheltered"), // nullable (null when no alt wall)
},
);