Skip to content

feat(mes): Week 1 — PostgreSQL mes_core schema + Alembic migrations#139

Merged
Mikecranesync merged 1 commit into
mainfrom
feat/mes-week1-db-schema
Apr 16, 2026
Merged

feat(mes): Week 1 — PostgreSQL mes_core schema + Alembic migrations#139
Mikecranesync merged 1 commit into
mainfrom
feat/mes-week1-db-schema

Conversation

@Mikecranesync
Copy link
Copy Markdown
Owner

Summary

  • Introduces services/mes/ — first MES microservice in the factorylm monorepo
  • 7-table PostgreSQL schema (mes_core) with full Alembic migration
  • Pydantic UDTs matching Walker Reynolds' 8-Week MES Bootcamp design
  • FastAPI skeleton (/api/health only — Week 2 adds full routes)
  • Docker: factorylm-mes-db (Postgres 16, port 5434) + factorylm-mes (port 8300)

Tables created

lines · products · work_orders · schedules · downtime_reasons · machine_states · oee_snapshots

Seed data

  • 14 downtime reason codes (MAINT_PM, MAINT_BREAKDOWN, JAM, E_STOP, ...)
  • 2 production lines (Conveyor-1, Sorting-1) with ISA-95 paths

Test plan

  • alembic upgrade head — clean migration, no errors
  • pytest tests/test_schema.py -v11/11 passing
  • All 7 tables present
  • All 5 enum types present
  • All 6 indexes present
  • Seed data verified (14 downtime codes, 2 lines with correct ISA-95 paths)

Related

🤖 Generated with Claude Code
via Happy

Introduces services/mes/ — the MES Core microservice layer for
FactoryLM. Implements Walker Reynolds' 8-Week MES Bootcamp schema
(Session 1) translated to our stack.

Changes:
- services/mes/: FastAPI skeleton + SQLAlchemy 2.x + Alembic setup
- 7 tables: lines, products, work_orders, schedules, downtime_reasons,
  machine_states, oee_snapshots
- 5 PostgreSQL enum types + 6 performance indexes
- Seed: 14 downtime reason codes, 2 production lines (ISA-95 paths)
- Pydantic UDTs: LineDataType, CountDispatch, OEEDataType
- infra/scada/mes.Dockerfile + docker-compose.yml (port 5434)
- 11/11 acceptance tests passing

Closes: Mikecranesync/MIRA#319
PRD: docs/PRD-MES-CORE.md

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
@Mikecranesync Mikecranesync merged commit 7f66a35 into main Apr 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(mes): Week 1 — PostgreSQL mes_core schema + Alembic migrations

1 participant