Files
nuzlocke-tracker/.beans/nuzlocke-tracker-ecn3--prune-stale-seed-data-during-seeding.md
Julian Tabel efa0b5f855 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>
2026-02-21 17:33:54 +01:00

869 B

title, status, type, priority, created_at, updated_at
title status type priority created_at updated_at
Prune stale seed data during seeding completed bug normal 2026-02-21T16:28:37Z 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.