mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
Move the live plan, recommendation, recommendation_materials and (retiring) plan_recommendations tables into a new infrastructure/postgres/modelling/ subpackage as single SQLModel definitions (the epc_property pattern), absorbing the rebuild's partial PlanRow/RecommendationRow mirrors and carrying full legacy column parity plus recommendation.plan_id. Out-of-cluster references are plain indexed ints (mirror convention); the live FKs are owned by the Drizzle schema. backend/app/db/models/recommendations.py becomes a re-export shim (ScenarioModel/InstalledMeasure stay for a later slice). Fix the export conftest to create SQLModel-first (so Base funding_package's FK to the now-SQLModel plan resolves) and skip the redundant drop_all on its function-scoped throwaway DB (the epc enum type is now shared across both metadatas). Resolves the pre-existing dual-definition collision: the rebuild and legacy export suites are now co-runnable. No behaviour change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
24 lines
787 B
Python
24 lines
787 B
Python
"""SQLModel definitions of the Modelling stage's live persistence tables
|
|
(ADR-0017 amendment).
|
|
|
|
One canonical SQLModel per physical table — `plan`, `recommendation`,
|
|
`recommendation_materials` — replacing the legacy SQLAlchemy `Base` models in
|
|
`backend/app/db/models/recommendations.py` (now a re-export shim, the
|
|
`epc_property` pattern). `recommendation` carries `plan_id`; the
|
|
`plan_recommendations` m2m is retired.
|
|
"""
|
|
|
|
from infrastructure.postgres.modelling.plan_table import PlanRow, PlanType
|
|
from infrastructure.postgres.modelling.recommendation_table import (
|
|
PlanRecommendationRow,
|
|
RecommendationMaterialRow,
|
|
RecommendationRow,
|
|
)
|
|
|
|
__all__ = [
|
|
"PlanRow",
|
|
"PlanType",
|
|
"RecommendationRow",
|
|
"RecommendationMaterialRow",
|
|
"PlanRecommendationRow",
|
|
]
|