- 019: ALTER listings (windows_view_type, wcs counts, ceiling_height,
repair_type, views, living_area, bedrooms, balconies, loggias,
description_minhash, cadastral_number, phones, bargain_allowed,
sale_type, house_source/ext_id, metro_stations)
- 020: ALTER houses (BTI: series_name, entrances, flat_count, is_emergency,
heat/gas/overlap types; Cian: cian_internal_house_id,
management_company_id, transport_accessibility_rate,
advantages/banks/builders/houses_by_turn jsonb + GIN indexes)
- 021: CREATE management_companies + FK to houses.management_company_id
- 022: CREATE agents table + agent_id_fk on listings
- 023: CREATE offer_price_history (per-listing price change timeline)
- 024: CREATE houses_price_dynamics (monthly price/sqm series)
- 025: CREATE house_reliability_checks (наш.дом.рф checks)
- 026: CREATE external_valuations (unified Avito IMV + Cian Valuation cache)
- 027: CREATE EXTENSION pgcrypto + cian_session_cookies (encrypted)
- 028: CREATE house_sources, listing_sources, house_address_aliases
+ address_fingerprint/canonical/merged_into alters
Refs: decisions/CianScraper_v1_Implementation_Plan.md Stage 1
decisions/Schema_Cian_SERP_Inventory.md sec 16, 20.3, 26
decisions/Cross_Source_Matching_Strategy.md sec 2
29 lines
1.1 KiB
PL/PgSQL
29 lines
1.1 KiB
PL/PgSQL
-- 025_house_reliability_checks.sql
|
|
-- Purpose: наш.дом.рф reliability check results scraped from Cian newbuilding pages.
|
|
-- Stores per-house check status and detail array.
|
|
-- Dependencies:
|
|
-- - houses table (009_houses.sql)
|
|
-- Deploy order: Apply after 024.
|
|
--
|
|
-- Sources: Schema_Cian_SERP_Inventory sec 16.4
|
|
|
|
BEGIN;
|
|
|
|
CREATE TABLE IF NOT EXISTS house_reliability_checks (
|
|
id bigserial PRIMARY KEY,
|
|
house_id bigint NOT NULL REFERENCES houses(id) ON DELETE CASCADE,
|
|
check_status text, -- 'reliable'/'problematic'/'unchecked'
|
|
check_name text, -- human-readable check name / title
|
|
details jsonb, -- [{type, title, iconType, ...}] raw checks array
|
|
source text NOT NULL DEFAULT 'cian_nashdom',
|
|
recorded_at timestamptz NOT NULL DEFAULT NOW()
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS hrc_house_idx
|
|
ON house_reliability_checks (house_id);
|
|
|
|
CREATE INDEX IF NOT EXISTS hrc_status_idx
|
|
ON house_reliability_checks (check_status)
|
|
WHERE check_status IS NOT NULL;
|
|
|
|
COMMIT;
|