gendesign/data/sql/111_22f_domrf_obj_checks.sql
lekss361 16e3d5c86d
All checks were successful
Deploy / changes (push) Successful in 5s
Deploy / deploy (push) Successful in 46s
Deploy / build-backend (push) Successful in 32s
Deploy / build-frontend (push) Has been skipped
Deploy / build-worker (push) Successful in 30s
feat(22f): domrf_obj_checks table — 6 "Проверено на наш.дом.рф" checks (#303)
2026-05-17 15:07:24 +00:00

49 lines
2.3 KiB
PL/PgSQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- 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;