# Skill: PostGIS Migration Use this skill when creating database models, migrations, geometry storage or spatial indexes. ## Read first - `docs/DATABASE_SCHEMA.md` - `docs/DATABASE_IMPLEMENTATION_PLAN.md` - `docs/standards/GIS_STANDARDS.md` - `docs/specs/STATE_MACHINES.md` - relevant ADRs ## Spatial rules - PostgreSQL + PostGIS is mandatory. - Store canonical geometry in PostGIS geometry columns. - Preserve original CRS metadata on datasets. - Normalize internal spatial operations according to GIS standards. - Create spatial indexes for queryable geometries. - Use explicit units for area, distance and length. ## Migration checklist - [ ] Add model. - [ ] Add migration. - [ ] Add indexes. - [ ] Add constraints. - [ ] Add state enum where required. - [ ] Add rollback-safe migration where practical. - [ ] Add fixture/test coverage for geometry roundtrip. ## Forbidden shortcuts - No geometry as unvalidated plain text for canonical records. - No silent CRS assumptions. - No schema drift from docs without updating the contract. ## Completion report fields - Tables changed. - Geometry columns added. - Indexes added. - Migration commands run. - Compatibility risks.