Add --prune flag to seed command to remove stale data
Without --prune, seeds continue to only upsert (add/update). With --prune, routes, encounters, and bosses not present in the seed JSON files are deleted from the database. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
---
|
||||
# nuzlocke-tracker-ecn3
|
||||
title: Prune stale seed data during seeding
|
||||
status: completed
|
||||
type: bug
|
||||
priority: normal
|
||||
created_at: 2026-02-21T16:28:37Z
|
||||
updated_at: 2026-02-21T16:29:43Z
|
||||
---
|
||||
|
||||
Seeds only upsert (add/update), they never remove routes, encounters, or bosses that no longer exist in the seed JSON. When routes are renamed, old route names persist in production.
|
||||
|
||||
## Fix
|
||||
|
||||
After upserting each entity type, delete rows not present in the seed data:
|
||||
|
||||
1. **Routes**: After upserting all routes for a version group, delete routes whose names are not in the seed set. FK cascades handle child routes and encounters.
|
||||
2. **Encounters**: After upserting encounters for a route+game, delete encounters not in the seed data for that route+game pair.
|
||||
3. **Bosses**: After upserting bosses for a version group, delete bosses with order values beyond what the seed provides.
|
||||
Reference in New Issue
Block a user