converting solar hot water to boolean

This commit is contained in:
Khalim Conn-Kowlessar 2023-08-01 11:45:10 +01:00
parent 49c485868b
commit 086ae9757d
4 changed files with 830 additions and 1 deletions

View file

@ -0,0 +1 @@
ALTER TABLE "property_details_epc" ALTER COLUMN "solar_hot_water" SET DATA TYPE boolean USING solar_hot_water::boolean;

View file

@ -0,0 +1,821 @@
{
"version": "5",
"dialect": "pg",
"id": "e376c439-1810-4d3b-a7a1-0e31be504faf",
"prevId": "e0d76bd5-8361-40d7-b6bb-0d22478ae4db",
"tables": {
"portfolio": {
"name": "portfolio",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"budget": {
"name": "budget",
"type": "real",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "status",
"primaryKey": false,
"notNull": true
},
"goal": {
"name": "goal",
"type": "goal",
"primaryKey": false,
"notNull": true
},
"cost": {
"name": "cost",
"type": "real",
"primaryKey": false,
"notNull": false
},
"number_of_properties": {
"name": "number_of_properties",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"co2_equivalent_savings": {
"name": "co2_equivalent_savings",
"type": "real",
"primaryKey": false,
"notNull": false
},
"energy_savings": {
"name": "energy_savings",
"type": "real",
"primaryKey": false,
"notNull": false
},
"energy_cost_savings": {
"name": "energy_cost_savings",
"type": "real",
"primaryKey": false,
"notNull": false
},
"property_valuation_increase": {
"name": "property_valuation_increase",
"type": "real",
"primaryKey": false,
"notNull": false
},
"rental_yield_increase": {
"name": "rental_yield_increase",
"type": "real",
"primaryKey": false,
"notNull": false
},
"total_work_hours": {
"name": "total_work_hours",
"type": "real",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp (6) with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp (6) with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {}
},
"portfolioUsers": {
"name": "portfolioUsers",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"portfolio_id": {
"name": "portfolio_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"role": {
"name": "role",
"type": "role",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp (6) with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp (6) with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"portfolioUsers_user_id_user_id_fk": {
"name": "portfolioUsers_user_id_user_id_fk",
"tableFrom": "portfolioUsers",
"tableTo": "user",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"portfolioUsers_portfolio_id_portfolio_id_fk": {
"name": "portfolioUsers_portfolio_id_portfolio_id_fk",
"tableFrom": "portfolioUsers",
"tableTo": "portfolio",
"columnsFrom": [
"portfolio_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {}
},
"property": {
"name": "property",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"portfolio_id": {
"name": "portfolio_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"creation_status": {
"name": "creation_status",
"type": "property_status",
"primaryKey": false,
"notNull": true
},
"uprn": {
"name": "uprn",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "property_status",
"primaryKey": false,
"notNull": false
},
"address": {
"name": "address",
"type": "text",
"primaryKey": false,
"notNull": false
},
"postcode": {
"name": "postcode",
"type": "text",
"primaryKey": false,
"notNull": false
},
"has_pre_condition_report": {
"name": "has_pre_condition_report",
"type": "boolean",
"primaryKey": false,
"notNull": false
},
"has_recommendations": {
"name": "has_recommendations",
"type": "boolean",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true
},
"property_type": {
"name": "property_type",
"type": "text",
"primaryKey": false,
"notNull": false
},
"built_form": {
"name": "built_form",
"type": "text",
"primaryKey": false,
"notNull": false
},
"local_authority": {
"name": "local_authority",
"type": "text",
"primaryKey": false,
"notNull": false
},
"constituency": {
"name": "constituency",
"type": "text",
"primaryKey": false,
"notNull": false
},
"number_of_rooms": {
"name": "number_of_rooms",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"year_built": {
"name": "year_built",
"type": "text",
"primaryKey": false,
"notNull": false
},
"tenure": {
"name": "tenure",
"type": "text",
"primaryKey": false,
"notNull": false
},
"current_epc_rating": {
"name": "current_epc_rating",
"type": "epc",
"primaryKey": false,
"notNull": false
},
"current_sap_points": {
"name": "current_sap_points",
"type": "real",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"property_portfolio_id_portfolio_id_fk": {
"name": "property_portfolio_id_portfolio_id_fk",
"tableFrom": "property",
"tableTo": "portfolio",
"columnsFrom": [
"portfolio_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {}
},
"property_details_epc": {
"name": "property_details_epc",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"property_id": {
"name": "property_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"portfolio_id": {
"name": "portfolio_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"full_address": {
"name": "full_address",
"type": "text",
"primaryKey": false,
"notNull": false
},
"total_floor_area": {
"name": "total_floor_area",
"type": "real",
"primaryKey": false,
"notNull": false
},
"walls": {
"name": "walls",
"type": "text",
"primaryKey": false,
"notNull": false
},
"walls_rating": {
"name": "walls_rating",
"type": "smallint",
"primaryKey": false,
"notNull": false
},
"roof": {
"name": "roof",
"type": "text",
"primaryKey": false,
"notNull": false
},
"roof_rating": {
"name": "roof_rating",
"type": "smallint",
"primaryKey": false,
"notNull": false
},
"floor": {
"name": "floor",
"type": "text",
"primaryKey": false,
"notNull": false
},
"floor_rating": {
"name": "floor_rating",
"type": "smallint",
"primaryKey": false,
"notNull": false
},
"windows": {
"name": "windows",
"type": "text",
"primaryKey": false,
"notNull": false
},
"windows_rating": {
"name": "windows_rating",
"type": "smallint",
"primaryKey": false,
"notNull": false
},
"heating": {
"name": "heating",
"type": "text",
"primaryKey": false,
"notNull": false
},
"heating_rating": {
"name": "heating_rating",
"type": "smallint",
"primaryKey": false,
"notNull": false
},
"heating_contols": {
"name": "heating_contols",
"type": "text",
"primaryKey": false,
"notNull": false
},
"heating_contols_rating": {
"name": "heating_contols_rating",
"type": "smallint",
"primaryKey": false,
"notNull": false
},
"hot_water": {
"name": "hot_water",
"type": "text",
"primaryKey": false,
"notNull": false
},
"hot_water_rating": {
"name": "hot_water_rating",
"type": "smallint",
"primaryKey": false,
"notNull": false
},
"lighting": {
"name": "lighting",
"type": "text",
"primaryKey": false,
"notNull": false
},
"lighting_rating": {
"name": "lighting_rating",
"type": "smallint",
"primaryKey": false,
"notNull": false
},
"ventilation": {
"name": "ventilation",
"type": "text",
"primaryKey": false,
"notNull": false
},
"solar_pv": {
"name": "solar_pv",
"type": "real",
"primaryKey": false,
"notNull": false
},
"solar_hot_water": {
"name": "solar_hot_water",
"type": "boolean",
"primaryKey": false,
"notNull": false
},
"wind_turbine": {
"name": "wind_turbine",
"type": "text",
"primaryKey": false,
"notNull": false
},
"floor_height": {
"name": "floor_height",
"type": "real",
"primaryKey": false,
"notNull": false
},
"number_heated_rooms": {
"name": "number_heated_rooms",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"heat_loss_corridor": {
"name": "heat_loss_corridor",
"type": "boolean",
"primaryKey": false,
"notNull": false
},
"unheated_corridor_length": {
"name": "unheated_corridor_length",
"type": "real",
"primaryKey": false,
"notNull": false
},
"number_of_open_fireplaces": {
"name": "number_of_open_fireplaces",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"number_of_extensions": {
"name": "number_of_extensions",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"number_of_storeys": {
"name": "number_of_storeys",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"mains_gas": {
"name": "mains_gas",
"type": "boolean",
"primaryKey": false,
"notNull": false
},
"energy_tariff": {
"name": "energy_tariff",
"type": "text",
"primaryKey": false,
"notNull": false
},
"primary_energy_consumption": {
"name": "primary_energy_consumption",
"type": "real",
"primaryKey": false,
"notNull": false
},
"co2_emissions": {
"name": "co2_emissions",
"type": "real",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"property_details_epc_property_id_property_id_fk": {
"name": "property_details_epc_property_id_property_id_fk",
"tableFrom": "property_details_epc",
"tableTo": "property",
"columnsFrom": [
"property_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"property_details_epc_portfolio_id_portfolio_id_fk": {
"name": "property_details_epc_portfolio_id_portfolio_id_fk",
"tableFrom": "property_details_epc",
"tableTo": "portfolio",
"columnsFrom": [
"portfolio_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {}
},
"property_details_meter": {
"name": "property_details_meter",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"uprn": {
"name": "uprn",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"energy_supplier": {
"name": "energy_supplier",
"type": "text",
"primaryKey": false,
"notNull": false
},
"gas_supplier": {
"name": "gas_supplier",
"type": "text",
"primaryKey": false,
"notNull": false
},
"meter_reading_total": {
"name": "meter_reading_total",
"type": "real",
"primaryKey": false,
"notNull": false
},
"meter_reading_electricity": {
"name": "meter_reading_electricity",
"type": "real",
"primaryKey": false,
"notNull": false
},
"meter_reading_gas": {
"name": "meter_reading_gas",
"type": "real",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {}
},
"property_targets": {
"name": "property_targets",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"property_id": {
"name": "property_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"portfolio_id": {
"name": "portfolio_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true
},
"epc": {
"name": "epc",
"type": "epc",
"primaryKey": false,
"notNull": false
},
"heat_demand": {
"name": "heat_demand",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"property_targets_property_id_property_id_fk": {
"name": "property_targets_property_id_property_id_fk",
"tableFrom": "property_targets",
"tableTo": "property",
"columnsFrom": [
"property_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"property_targets_portfolio_id_portfolio_id_fk": {
"name": "property_targets_portfolio_id_portfolio_id_fk",
"tableFrom": "property_targets",
"tableTo": "portfolio",
"columnsFrom": [
"portfolio_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {}
},
"user": {
"name": "user",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"firstName": {
"name": "firstName",
"type": "text",
"primaryKey": false,
"notNull": false
},
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": true
},
"oauth_id": {
"name": "oauth_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"oauth_provider": {
"name": "oauth_provider",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp (6) with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp (6) with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {}
}
},
"enums": {
"goal": {
"name": "goal",
"values": {
"Valuation Improvement": "Valuation Improvement",
"Increasing EPC": "Increasing EPC",
"Reducing CO2 emissions": "Reducing CO2 emissions",
"Energy Savings": "Energy Savings",
"None": "None"
}
},
"role": {
"name": "role",
"values": {
"creator": "creator",
"admin": "admin",
"read": "read",
"write": "write"
}
},
"status": {
"name": "status",
"values": {
"scoping": "scoping",
"assessment": "assessment",
"tendering": "tendering",
"project underway": "project underway",
"completion; status: on track": "completion; status: on track",
"completion; status: delayed": "completion; status: delayed",
"completion; status: at risk": "completion; status: at risk",
"completion; status: completed": "completion; status: completed",
"needs review": "needs review"
}
},
"epc": {
"name": "epc",
"values": {
"A": "A",
"B": "B",
"C": "C",
"D": "D",
"E": "E",
"F": "F",
"G": "G"
}
},
"property_status": {
"name": "property_status",
"values": {
"scoping": "scoping",
"assessment": "assessment",
"tendering": "tendering",
"project underway": "project underway",
"completion; status: on track": "completion; status: on track",
"completion; status: delayed": "completion; status: delayed",
"completion; status: at risk": "completion; status: at risk",
"completion; status: completed": "completion; status: completed",
"needs review": "needs review"
}
}
},
"schemas": {},
"_meta": {
"schemas": {},
"tables": {},
"columns": {}
}
}

View file

@ -78,6 +78,13 @@
"when": 1690886369813,
"tag": "0010_dizzy_thor",
"breakpoints": true
},
{
"idx": 11,
"version": "5",
"when": 1690886677110,
"tag": "0011_lethal_wrecker",
"breakpoints": true
}
]
}

View file

@ -139,7 +139,7 @@ export const propertyDetailsEpc = pgTable("property_details_epc", {
lightingRating: smallint("lighting_rating"),
ventilation: text("ventilation"),
solarPv: real("solar_pv"),
solarHotWater: text("solar_hot_water"),
solarHotWater: boolean("solar_hot_water"),
windTurbine: text("wind_turbine"),
floorHeight: real("floor_height"),
numberHeatedRooms: integer("number_heated_rooms"),