assessment-model/src/app/db/migrations/0075_even_phalanx.sql
2024-07-25 18:28:42 +01:00

115 lines
4.1 KiB
SQL

CREATE TABLE IF NOT EXISTS "energy_assessments" (
"id" bigserial PRIMARY KEY NOT NULL,
"uprn" bigint NOT NULL,
"uprn_source" text NOT NULL,
"property_type" text NOT NULL,
"building_reference_number" text,
"current_energy_efficiency" text NOT NULL,
"current_energy_rating" text NOT NULL,
"address1" text NOT NULL,
"address2" text NOT NULL,
"address3" text,
"posttown" text NOT NULL,
"postcode" text NOT NULL,
"address" text NOT NULL,
"county" text[],
"constituency" text,
"constituency_label" text,
"low_energy_fixed_light_count" text NOT NULL,
"construction_age_band" text NOT NULL,
"mainheat_energy_eff" text NOT NULL,
"windows_env_eff" text NOT NULL,
"lighting_energy_eff" text NOT NULL,
"environmentImpactPotential" text NOT NULL,
"mainheatcont_description" text NOT NULL,
"sheating_energy_eff" text NOT NULL,
"local_authority" text NOT NULL,
"local_authority_label" text NOT NULL,
"fixed_lighting_outlets_count" text NOT NULL,
"energy_tariff" text NOT NULL,
"mechanical_ventilation" text NOT NULL,
"solar_water_heating_flag" text NOT NULL,
"co2_emissions_potential" text NOT NULL,
"number_heated_rooms" text NOT NULL,
"floor_description" text NOT NULL,
"energy_consumption_potential" text NOT NULL,
"built_form" text NOT NULL,
"number_open_fireplaces" text NOT NULL,
"windows_description" text NOT NULL,
"glazed_area" text NOT NULL,
"inspection_date" timestamp (6) with time zone NOT NULL,
"mains_gas_flag" text NOT NULL,
"co2_emiss_curr_per_floor_area" text NOT NULL,
"heat_loss_corridor" text NOT NULL,
"unheated_corridor_length" text,
"flat_storey_count" text,
"roof_energy_eff" text NOT NULL,
"total_floor_area" text NOT NULL,
"environment_impact_current" text NOT NULL,
"roof_description" text NOT NULL,
"floor_energy_eff" text NOT NULL,
"number_habitable_rooms" text NOT NULL,
"hot_water_env_eff" text NOT NULL,
"mainheatc_energy_eff" text NOT NULL,
"main_fuel" text NOT NULL,
"lighting_env_eff" text NOT NULL,
"windows_energy_eff" text NOT NULL,
"floor_env_eff" text NOT NULL,
"sheating_env_eff" text NOT NULL,
"lighting_description" text NOT NULL,
"roof_env_eff" text NOT NULL,
"walls_energy_eff" text NOT NULL,
"photo_supply" text NOT NULL,
"lighting_cost_potential" text NOT NULL,
"mainheat_env_eff" text NOT NULL,
"multi_glaze_proportion" text NOT NULL,
"main_heating_controls" text NOT NULL,
"flat_top_storey" text,
"secondheat_description" text NOT NULL,
"walls_env_eff" text NOT NULL,
"transaction_type" text NOT NULL,
"extension_count" text NOT NULL,
"mainheatc_env_eff" text NOT NULL,
"lmk_key" text,
"wind_turbine_count" text NOT NULL,
"tenure" text NOT NULL,
"floor_level" text NOT NULL,
"potential_energy_efficiency" text NOT NULL,
"potential_energy_rating" text NOT NULL,
"hot_water_energy_eff" text NOT NULL,
"low_energy_lighting" text NOT NULL,
"walls_description" text NOT NULL,
"hotwater_description" text NOT NULL,
"co2_emissions_current" text NOT NULL,
"heating_cost_current" text NOT NULL,
"heating_cost_potential" text NOT NULL,
"hot_water_cost_current" text NOT NULL,
"hot_water_cost_potential" text NOT NULL,
"lighting_cost_current" text NOT NULL,
"energy_consumption_current" text NOT NULL,
"lodgement_date" timestamp (6) with time zone NOT NULL,
"lodgement_datetime" timestamp (6) with time zone NOT NULL,
"mainheat_description" text NOT NULL,
"floor_height" real NOT NULL,
"glazed_type" text NOT NULL,
"file_location" text NOT NULL,
"surveyor_name" text NOT NULL,
"surveyor_company" text NOT NULL,
"space_heating_kwh" text NOT NULL,
"water_heating_kwh" text NOT NULL,
"number_of_doors" integer NOT NULL,
"number_of_insulated_doors" integer NOT NULL,
"number_of_floors" integer NOT NULL,
"insulation_wall_area" real NOT NULL,
"heat_loss_perimeter" real NOT NULL,
"party_wall_length" real NOT NULL,
"perimeter" real NOT NULL,
"rooms_with_bath_and_or_shower" integer,
"rooms_with_mixer_shower_no_bath" integer,
"room_with_bath_and_mixer_shower" integer,
"percent_draftproofed" integer,
"has_hot_water_cylinder" boolean,
"cylinder_insulation_type" text,
"cylinder_insulation_thickness" integer,
"cylinder_thermostat" boolean
);