gendesign/data/sql/83_cad_parcels_geom.sql

26 lines
1.2 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.

-- 83_cad_parcels_geom.sql
-- Context : хранение геометрии участков (4-part cad: XX:YY:ZZZZZZZ:NN) из NSPD (thematic_id=1).
-- По аналогии с cad_quarters_geom (3-part cad).
-- Dependency: PostGIS extension уже установлен (используется cad_quarters_geom, cad_buildings).
-- Deploy order: standalone, нет FK-зависимостей от других таблиц.
-- Идемпотентность: безопасно повторно запускать (IF NOT EXISTS).
BEGIN;
CREATE TABLE IF NOT EXISTS cad_parcels_geom (
cad_num TEXT PRIMARY KEY, -- 4-part cad: 66:41:0204016:10
geom GEOMETRY(Geometry, 4326) NOT NULL, -- Polygon | MultiPolygon
raw_props JSONB DEFAULT '{}'::jsonb,
fetched_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
COMMENT ON TABLE cad_parcels_geom IS
'Геометрия участков (4-part cad, thematic_id=1) из NSPD. '
'Источник: nspd_geo task. '
'Используется site-finder analyze endpoint как fallback для 4-part cad '
'если в cad_quarters_geom нет.';
CREATE INDEX IF NOT EXISTS cad_parcels_geom_gist
ON cad_parcels_geom USING GIST (geom);
COMMIT;