revising fields on the scenario model

This commit is contained in:
Khalim Conn-Kowlessar 2024-07-30 18:32:32 +01:00
parent f06e50a60f
commit f0d197a1a8
4 changed files with 2835 additions and 26 deletions

View file

@ -0,0 +1,20 @@
ALTER TABLE "scenario" ADD COLUMN "cost" real;--> statement-breakpoint
ALTER TABLE "scenario" ADD COLUMN "total_work_hours" real;--> statement-breakpoint
ALTER TABLE "scenario" ADD COLUMN "energy_savings" real;--> statement-breakpoint
ALTER TABLE "scenario" ADD COLUMN "co2_equivalent_savings" real;--> statement-breakpoint
ALTER TABLE "scenario" ADD COLUMN "energy_cost_savings" real;--> statement-breakpoint
ALTER TABLE "scenario" ADD COLUMN "epc_breakdown_pre_retrofit" text;--> statement-breakpoint
ALTER TABLE "scenario" ADD COLUMN "epc_breakdown_post_retrofit" text;--> statement-breakpoint
ALTER TABLE "scenario" ADD COLUMN "number_of_properties" integer;--> statement-breakpoint
ALTER TABLE "scenario" ADD COLUMN "n_units_to_retrofit" integer;--> statement-breakpoint
ALTER TABLE "scenario" ADD COLUMN "co2_per_unit_pre_retrofit" text;--> statement-breakpoint
ALTER TABLE "scenario" ADD COLUMN "co2_per_unit_post_retrofit" text;--> statement-breakpoint
ALTER TABLE "scenario" ADD COLUMN "energy_bill_per_unit_pre_retrofit" text;--> statement-breakpoint
ALTER TABLE "scenario" ADD COLUMN "energy_bill_per_unit_post_retrofit" text;--> statement-breakpoint
ALTER TABLE "scenario" ADD COLUMN "energy_consumption_per_unit_pre_retrofit" text;--> statement-breakpoint
ALTER TABLE "scenario" ADD COLUMN "energy_consumption_per_unit_post_retrofit" text;--> statement-breakpoint
ALTER TABLE "scenario" ADD COLUMN "valuation_improvement_per_unit" text;--> statement-breakpoint
ALTER TABLE "scenario" ADD COLUMN "cost_per_unit" text;--> statement-breakpoint
ALTER TABLE "scenario" ADD COLUMN "cost_per_co2_saved" text;--> statement-breakpoint
ALTER TABLE "scenario" ADD COLUMN "cost_per_sap_point" text;--> statement-breakpoint
ALTER TABLE "scenario" ADD COLUMN "valuation_return_on_investment" text;

File diff suppressed because it is too large Load diff

View file

@ -596,6 +596,13 @@
"when": 1722359514687,
"tag": "0084_brief_wolf_cub",
"breakpoints": true
},
{
"idx": 85,
"version": "5",
"when": 1722359570368,
"tag": "0085_nosy_gideon",
"breakpoints": true
}
]
}

View file

@ -79,32 +79,6 @@ export const plan = pgTable("plan", {
valuationIncreaseLowerBound: real("valuation_increase_lower_bound"),
valuationIncreaseUpperBound: real("valuation_increase_upper_bound"),
valuationIncreaseAverage: real("valuation_increase_average"),
// // Aggregations that were previously being stored against the portfolio, that are now being stored against the plan
// cost: real("cost"),
// totalWorkHours: real("total_work_hours"),
// energySavings: real("energy_savings"), // Unit is always kWh so we don't need to store unit
// co2EquivalentSavings: real("co2_equivalent_savings"), // Unit is always tonnes so we don't need to store unit
// energyCostSavings: real("energy_cost_savings"), // Unit is always £ so we don't need to store unit for the moment
// // Aggregates added for the summary tab
// epcBreakdownPreRetrofit: text("epc_breakdown_pre_retrofit"),
// epcBreakdownPostRetrofit: text("epc_breakdown_post_retrofit"),
// numberOfProperties: integer("number_of_properties"),
// nUnitsToRetrofit: integer("n_units_to_retrofit"),
// co2PerUnitPreRetrofit: text("co2_per_unit_pre_retrofit"),
// co2PerUnitPostRetrofit: text("co2_per_unit_post_retrofit"),
// energyBillPerUnitPreRetrofit: text("energy_bill_per_unit_pre_retrofit"),
// energyBillPerUnitPostRetrofit: text("energy_bill_per_unit_post_retrofit"),
// energyConsumptionPerUnitPreRetrofit: text(
// "energy_consumption_per_unit_pre_retrofit"
// ),
// energyConsumptionPerUnitPostRetrofit: text(
// "energy_consumption_per_unit_post_retrofit"
// ),
// valuationImprovementPerUnit: text("valuation_improvement_per_unit"),
// costPerUnit: text("cost_per_unit"),
// costPerCo2Saved: text("cost_per_co2_saved"),
// costPerSapPoint: text("cost_per_sap_point"),
// valuationReturnOnInvestment: text("valuation_return_on_investment"),
});
export const planRecommendations = pgTable("plan_recommendations", {
@ -141,6 +115,32 @@ export const scenario = pgTable("scenario", {
),
exclusions: text("exclusions"),
multiPlan: boolean("multi_plan"),
// Aggregations that were previously being stored against the portfolio, that are now being stored against the scenario
cost: real("cost"),
totalWorkHours: real("total_work_hours"),
energySavings: real("energy_savings"), // Unit is always kWh so we don't need to store unit
co2EquivalentSavings: real("co2_equivalent_savings"), // Unit is always tonnes so we don't need to store unit
energyCostSavings: real("energy_cost_savings"), // Unit is always £ so we don't need to store unit for the moment
// Aggregates added for the summary tab
epcBreakdownPreRetrofit: text("epc_breakdown_pre_retrofit"),
epcBreakdownPostRetrofit: text("epc_breakdown_post_retrofit"),
numberOfProperties: integer("number_of_properties"),
nUnitsToRetrofit: integer("n_units_to_retrofit"),
co2PerUnitPreRetrofit: text("co2_per_unit_pre_retrofit"),
co2PerUnitPostRetrofit: text("co2_per_unit_post_retrofit"),
energyBillPerUnitPreRetrofit: text("energy_bill_per_unit_pre_retrofit"),
energyBillPerUnitPostRetrofit: text("energy_bill_per_unit_post_retrofit"),
energyConsumptionPerUnitPreRetrofit: text(
"energy_consumption_per_unit_pre_retrofit"
),
energyConsumptionPerUnitPostRetrofit: text(
"energy_consumption_per_unit_post_retrofit"
),
valuationImprovementPerUnit: text("valuation_improvement_per_unit"),
costPerUnit: text("cost_per_unit"),
costPerCo2Saved: text("cost_per_co2_saved"),
costPerSapPoint: text("cost_per_sap_point"),
valuationReturnOnInvestment: text("valuation_return_on_investment"),
});
export type Plan = InferModel<typeof plan, "select">;