# Pass 03 — Database and Domain Foundation ## Goal Add the PostGIS-ready database/domain foundation. ## Implement - SQLAlchemy database setup. - Alembic migration setup. - Core models: Project, Area, Dataset, AnalysisRun, Export. - Pydantic schemas matching API contract style. - Geometry handling strategy ready for PostGIS. ## Constraints - Do not store geometry as arbitrary strings in final domain models. - If test environment cannot run PostGIS, isolate integration tests and keep unit tests safe. - Do not remove future raster/AI fields because V1 starts smaller. ## Validation - Backend imports. - Model metadata initializes. - Migration command documented or executed if environment allows. - Unit tests pass. ## Acceptance - Domain model can support project -> area -> dataset -> analysis. - Geometry metadata and CRS are represented. - Execution log updated.