diff --git a/src/app/db/schema/recommendations.ts b/src/app/db/schema/recommendations.ts index 0c74a584..af7acf0e 100644 --- a/src/app/db/schema/recommendations.ts +++ b/src/app/db/schema/recommendations.ts @@ -263,6 +263,13 @@ export const planRecommendations = pgTable( table.planId, table.recommendationId, ), + // Supports the FK check fired when `recommendation` rows are deleted + // (cascaded from plan deletes); without it each delete seq-scans this + // ~26M-row table. Already created on the live DB (CONCURRENTLY, + // 2026-07-02) — the migration must match the existing index name. + index("idx_plan_recommendations_recommendation_id").on( + table.recommendationId, + ), ], );