New table domrf_obj_checks (PK: obj_id, check_type) stores per-object pass/fail state for the 6 verification checks shown on наш.дом.рф flat pages: no_problems, docs, timing, photos, bankruptcy, declaration. Closes #297 (sub-task 22f).
49 lines
2.3 KiB
PL/PgSQL
49 lines
2.3 KiB
PL/PgSQL
-- Migration: 111_22f_domrf_obj_checks.sql
|
||
-- Context: Issue #297 sub-task 22f — "Проверено на наш.дом.рф" 6 checks per obj
|
||
-- Dependencies: domrf_kn_objects (obj_id values come from there; no FK enforced — obj_id
|
||
-- is a bigint key, not a FK, to allow scraping checks before obj row exists)
|
||
-- Deploy order: standalone — no prior migration required
|
||
-- Idempotent: yes (IF NOT EXISTS throughout)
|
||
|
||
BEGIN;
|
||
|
||
CREATE TABLE IF NOT EXISTS domrf_obj_checks (
|
||
obj_id bigint NOT NULL,
|
||
check_type text NOT NULL,
|
||
-- check_type values: no_problems / docs / timing / photos / bankruptcy / declaration
|
||
passed bool NOT NULL,
|
||
checked_at timestamptz NOT NULL DEFAULT NOW(),
|
||
scraped_at timestamptz NOT NULL DEFAULT NOW(),
|
||
PRIMARY KEY (obj_id, check_type)
|
||
);
|
||
|
||
CREATE INDEX IF NOT EXISTS domrf_obj_checks_obj_idx
|
||
ON domrf_obj_checks (obj_id);
|
||
|
||
COMMENT ON TABLE domrf_obj_checks IS
|
||
'6 проверок «Проверено на наш.дом.рф» per obj_id: '
|
||
'no_problems, docs, timing, photos, bankruptcy, declaration. '
|
||
'Issue #297 sub-task 22f.';
|
||
|
||
COMMENT ON COLUMN domrf_obj_checks.obj_id IS
|
||
'DOM.РФ объект (кн-объект); из domrf_kn_objects.obj_id.';
|
||
|
||
COMMENT ON COLUMN domrf_obj_checks.check_type IS
|
||
'Тип проверки. Допустимые значения: '
|
||
'no_problems — у застройщика нет проблемных объектов; '
|
||
'docs — опубликован полный комплект документов; '
|
||
'timing — сроки строительства соблюдены; '
|
||
'photos — актуальные фото хода строительства; '
|
||
'bankruptcy — застройщик не банкрот; '
|
||
'declaration — проектная декларация обновлена.';
|
||
|
||
COMMENT ON COLUMN domrf_obj_checks.passed IS
|
||
'TRUE = чек пройден (зелёная галочка на наш.дом.рф).';
|
||
|
||
COMMENT ON COLUMN domrf_obj_checks.checked_at IS
|
||
'Дата/время актуальности чека по данным DOM.РФ (берётся из payload).';
|
||
|
||
COMMENT ON COLUMN domrf_obj_checks.scraped_at IS
|
||
'Дата/время последнего scrape, когда строка была записана/обновлена.';
|
||
|
||
COMMIT;
|