mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-07-19 17:02:59 +00:00
Merge pull request #350 from Hestia-Homes/fix/plan-recommendations-rec-id-index
Add index on plan_recommendations.recommendation_id to Drizzle schema
This commit is contained in:
commit
f788c858c6
4 changed files with 11793 additions and 0 deletions
|
|
@ -0,0 +1,4 @@
|
|||
-- IF NOT EXISTS: this index was already created on the live DB on 2026-07-02
|
||||
-- (CREATE INDEX CONCURRENTLY, outside the migration flow) to unblock a plan
|
||||
-- cleanup; there this migration must no-op. Fresh environments build it here.
|
||||
CREATE INDEX IF NOT EXISTS "idx_plan_recommendations_recommendation_id" ON "plan_recommendations" USING btree ("recommendation_id");
|
||||
11775
src/app/db/migrations/meta/0258_snapshot.json
Normal file
11775
src/app/db/migrations/meta/0258_snapshot.json
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1800,6 +1800,13 @@
|
|||
"when": 1782999533851,
|
||||
"tag": "0257_low_songbird",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 258,
|
||||
"version": "7",
|
||||
"when": 1783009784235,
|
||||
"tag": "0258_plan_recommendations_rec_id_index",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -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,
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue