migration

This commit is contained in:
Daniel Roth 2026-01-28 10:51:52 +00:00
parent 1bd3ac4266
commit 48be05caea
3 changed files with 5694 additions and 0 deletions

View file

@ -0,0 +1,30 @@
CREATE TYPE "public"."aspect_type" AS ENUM('material', 'condition', 'type', 'area', 'configuration', 'presence', 'risk', 'severity', 'location', 'finish', 'insulation', 'pointing', 'spalling', 'lintels', 'cladding', 'category', 'quantity', 'adequacy', 'rating', 'strategy', 'extent', 'distribution', 'structure', 'covering', 'fire_rating', 'external_decoration', 'work_required', 'age_band', 'construction_type', 'classification', 'system');--> statement-breakpoint
CREATE TYPE "public"."element_type" AS ENUM('property', 'property_construction_type', 'property_classification', 'property_age_band', 'storey_count', 'floor_level', 'floor_level_front_door', 'accessible_housing_register', 'asbestos', 'quality_standard', 'ccu', 'passenger_lift', 'stairlift', 'disabled_hoist_tracking', 'disabled_facilities', 'steps_to_front_door', 'roof', 'pitched_roof_covering', 'flat_roof_covering', 'rainwater_goods', 'loft_insulation', 'porch_canopy', 'chimney', 'fascia', 'soffit', 'fascia_soffit_bargeboards', 'gutters', 'store_roof', 'garage_roof', 'garage_and_store_roof', 'external_wall', 'external_noise_insulation', 'primary_wall', 'secondary_wall', 'downpipes', 'external_decoration', 'cladding', 'spandrel_panels', 'garage_walls', 'party_wall_fire_break', 'external_brickwork_pointing', 'internal_downpipes_external_area', 'external_windows', 'communal_windows', 'secondary_glazing', 'store_windows', 'garage_windows', 'garage_and_store_windows', 'external_door', 'front_door', 'rear_door', 'store_door', 'garage_door', 'garage_and_store_door', 'communal_entrance_door', 'main_door', 'block_entrance_door', 'lintel', 'patio_french_door', 'door_entry_handset', 'paths_and_hardstandings', 'parking_areas', 'boundary_walls', 'front_fencing', 'rear_fencing', 'side_fencing', 'rear_gate', 'front_gate', 'gates', 'retaining_walls', 'private_balcony', 'balcony_balustrade', 'outbuildings', 'garage_structure', 'paving', 'roads', 'soil_and_vent', 'solar_thermals', 'drop_kerb', 'outbuilding_overhaul', 'external_structural_defects', 'access_ramp', 'kitchen', 'kitchen_space_layout', 'tenant_installed_kitchen', 'kitchen_extractor_fan', 'bathroom', 'secondary_bathroom', 'secondary_toilet', 'bathroom_extractor_fan', 'additional_wc_or_whb', 'bathroom_remaining_life_source', 'kitchen_remaining_life_source', 'central_heating', 'heating_boiler', 'heating_distribution', 'secondary_heating', 'hot_water_system', 'cold_water_storage', 'heating_system', 'boiler_fuel', 'water_heating', 'programmable_heating', 'community_heating', 'gas_available', 'heat_recovery_units', 'heating_improvements', 'electrical_wiring', 'consumer_unit', 'smoke_detection', 'heat_detection', 'carbon_monoxide_detection', 'fire_door_rating', 'fire_risk_assessment', 'internal_wiring', 'electrics', 'communal_heating', 'communal_boiler', 'communal_electrics', 'communal_fire_alarm', 'communal_emergency_lighting', 'communal_door_entry', 'communal_cctv', 'communal_bin_store', 'communal_bin_store_doors', 'communal_bin_store_walls', 'communal_bin_store_roof', 'communal_refuse_chute', 'communal_floor_covering', 'communal_kitchen', 'communal_bathroom', 'communal_toilets', 'communal_gates', 'communal_lift', 'communal_passenger_lift', 'communal_balcony_walkway', 'communal_entrance', 'communal_internal_decorations', 'communal_internal_floor', 'communal_walkways', 'communal_external_doors', 'communal_stairs', 'communal_aerial', 'communal_aov', 'communal_internal_doors', 'communal_lateral_mains', 'communal_lighting', 'communal_lighting_conductor', 'communal_store_roof', 'communal_store_walls', 'communal_store_doors', 'communal_warden_call_system', 'communal_bms', 'communal_booster_pump', 'communal_dry_riser', 'communal_wet_riser', 'communal_cold_water_storage', 'communal_sprinkler', 'communal_plug_sockets', 'communal_circulation_space', 'ffhh_damp', 'ffhh_hold_and_cold_water', 'ffhh_drainage_lavatories', 'ffhh_neglected', 'ffhh_natural_light', 'ffhh_ventilation', 'ffhh_food_prep_and_washup', 'ffhh_unsafe_layout', 'ffhh_unstable_building', 'hhsrs_damp_and_mould', 'hhsrs_excess_cold', 'hhsrs_excess_heat', 'hhsrs_asbestos_and_mmf', 'hhsrs_biocides', 'hhsrs_carbon_monoxide', 'hhsrs_lead', 'hhsrs_radiation', 'hhsrs_uncombusted_fuel_gas', 'hhsrs_volatile_organic_compounds', 'hhsrs_crowding_and_space', 'hhsrs_entry_by_intruders', 'hhsrs_lighting', 'hhsrs_noise', 'hhsrs_domestic_hygiene_pests_refuse', 'hhsrs_food_safety', 'hhsrs_personal_hygiene_sanitation', 'hhsrs_water_supply', 'hhsrs_falls_associated_with_baths', 'hhsrs_falls_on_level_surfaces', 'hhsrs_falls_on_stairs', 'hhsrs_falls_between_levels', 'hhsrs_electrical_hazards', 'hhsrs_fire', 'hhsrs_flames_hot_surfaces', 'hhsrs_collision_and_entrapment', 'hhsrs_collision_hazards_low_headroom', 'hhsrs_explosions', 'hhsrs_ergonomics', 'hhsrs_structural_collapse', 'hhsrs_amenities');--> statement-breakpoint
CREATE TABLE "aspect_condition" (
"id" bigserial PRIMARY KEY NOT NULL,
"element_id" bigint NOT NULL,
"aspect_type" "aspect_type" NOT NULL,
"aspect_instance" integer NOT NULL,
"value" text,
"quantity" integer,
"install_date" date,
"renewal_year" integer,
"comments" text
);
--> statement-breakpoint
CREATE TABLE "element" (
"id" bigserial PRIMARY KEY NOT NULL,
"survey_id" bigint NOT NULL,
"element_type" "element_type" NOT NULL,
"element_instance" integer NOT NULL
);
--> statement-breakpoint
CREATE TABLE "property_condition_survey" (
"id" bigserial PRIMARY KEY NOT NULL,
"uprn" bigint NOT NULL,
"date" date NOT NULL,
"source" text NOT NULL
);
--> statement-breakpoint
ALTER TABLE "aspect_condition" ADD CONSTRAINT "aspect_condition_element_id_element_id_fk" FOREIGN KEY ("element_id") REFERENCES "public"."element"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "element" ADD CONSTRAINT "element_survey_id_property_condition_survey_id_fk" FOREIGN KEY ("survey_id") REFERENCES "public"."property_condition_survey"("id") ON DELETE no action ON UPDATE no action;

File diff suppressed because it is too large Load diff

View file

@ -1044,6 +1044,13 @@
"when": 1767823836420,
"tag": "0148_first_gamma_corps",
"breakpoints": true
},
{
"idx": 149,
"version": "7",
"when": 1769597155526,
"tag": "0149_rich_luminals",
"breakpoints": true
}
]
}