mirror of
https://github.com/SamyRai/turash.git
synced 2025-12-26 23:01:33 +00:00
16 lines
772 B
SQL
Executable File
16 lines
772 B
SQL
Executable File
-- +migrate Up
|
|
-- Migration to add footprint_geometry column to sites table for building polygons
|
|
|
|
-- Add footprint geometry column to sites table for storing building polygons
|
|
ALTER TABLE sites ADD COLUMN IF NOT EXISTS footprint_geometry GEOMETRY(POLYGON, 4326);
|
|
|
|
-- Create spatial index for footprint geometry
|
|
CREATE INDEX IF NOT EXISTS idx_sites_footprint ON sites USING GIST (footprint_geometry);
|
|
|
|
-- Add check constraint for geometry validity
|
|
ALTER TABLE sites ADD CONSTRAINT chk_sites_footprint_geometry
|
|
CHECK (footprint_geometry IS NULL OR ST_IsValid(footprint_geometry));
|
|
|
|
-- Add comment for documentation
|
|
COMMENT ON COLUMN sites.footprint_geometry IS 'Building footprint polygon geometry in WGS84 (SRID 4326) - stores actual building outlines from OSM data';
|