From 27fcc5b18465f3f92fa36f17ea3688bb3917a753 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Wed, 3 Jun 2026 21:01:56 +0000 Subject: [PATCH] feat(modelling): legacy writers set recommendation.plan_id (dual-write) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit upload_recommendations and bulk_upload_recommendations_and_materials now set plan_id on each recommendation row (the plan id is already in scope), while still writing the plan_recommendations m2m — the dual-write that lets readers move onto plan_id with no breakage during the transition (ADR-0017 amendment / docs/migrations/recommendation-plan-id.md). The m2m write is removed in a later slice once no reader depends on it. Co-Authored-By: Claude Opus 4.8 --- backend/app/db/functions/recommendations_functions.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/backend/app/db/functions/recommendations_functions.py b/backend/app/db/functions/recommendations_functions.py index ed3fb435..72affd2a 100644 --- a/backend/app/db/functions/recommendations_functions.py +++ b/backend/app/db/functions/recommendations_functions.py @@ -261,6 +261,7 @@ def upload_recommendations( recommendations_data = [ { "property_id": property_id, + "plan_id": new_plan_id, "type": rec["type"], "measure_type": rec["measure_type"], "description": rec["description"], @@ -353,6 +354,7 @@ def bulk_upload_recommendations_and_materials( recommendation_rows.append( { "property_id": rec["property_id"], + "plan_id": rec["plan_id"], "type": rec["type"], "measure_type": rec["measure_type"], "description": rec["description"],