turash/bugulma/backend/migrations/postgres/014_add_site_footprint_geometry.up.sql
Damir Mukimov 0df4812c82
feat: Complete geographical features implementation with full test coverage
- Add comprehensive geographical data models (GeographicalFeature, TransportMode, TransportProfile, TransportOption)
- Implement geographical feature repository with PostGIS support and spatial queries
- Create transportation service for cost calculation and route optimization
- Build spatial resource matcher for geographical resource matching
- Develop environmental impact service for site environmental scoring
- Implement facility location optimizer with multi-criteria analysis
- Add geographical data migration service for SQLite to PostgreSQL migration
- Create database migrations for geographical features and site footprints
- Update geospatial service integration and server initialization
- Add CLI command for geographical data synchronization
- Implement complete test coverage for all geographical components (28 test cases)
- Update test infrastructure for geographical table creation and PostGIS handling

This implements advanced geospatial capabilities including transportation cost modeling, environmental impact assessment, and facility location optimization for the Turash platform.
2025-11-25 06:42:18 +01:00

16 lines
772 B
SQL

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