fix(admin): re-key legacy plans before seeding, tolerant of a prior partial boot
Server Deploy / deploy (push) Successful in 1m5s
Server Deploy / deploy (push) Successful in 1m5s
Boot ran SeedPlans before Backfill, so the fresh (self_hosted, professional) seed row was inserted before pass 3 tried to rename the legacy self_hosted TIER row into it — colliding on deployment_tier_unique and failing boot. The plan re-key moves to MigrateLegacyPlans, called before SeedPlans so the rename lands first and the seed no-ops on it. It is also self-healing: on a database a crashed boot already seeded (self_hosted, professional) into, the legacy row can no longer be renamed onto it, so it is dropped instead — its instances are re-tiered and re-entitled from the surviving professional row. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -64,6 +64,13 @@ func main() {
|
||||
idxCancel()
|
||||
log.Fatalf("indexes: %v", err)
|
||||
}
|
||||
// Legacy plans are re-keyed BEFORE the seed, so the seed's fresh
|
||||
// (self_hosted, professional) row cannot collide with the legacy self_hosted
|
||||
// row's rename on deployment_tier_unique.
|
||||
if err := models.MigrateLegacyPlans(idxCtx); err != nil {
|
||||
idxCancel()
|
||||
log.Fatalf("migrate legacy plans: %v", err)
|
||||
}
|
||||
if err := models.SeedPlans(idxCtx); err != nil {
|
||||
idxCancel()
|
||||
log.Fatalf("plan seed: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user