Summary
Editing an add-on group deletes all existing child rows and recreates them with new UUIDs. Historical normalized order snapshots retain name/price but lose their catalog addon_id link. CSV imports also silently reactivate soft-deleted records and report reactivated rows as created.
Current behavior
main/routes/addon-groups.ts:197-226 deletes and recreates every child during a group update.
main/routes/menu-csv.ts:393-434 reactivates groups/add-ons without separate reactivation counters.
main/db.ts:2420-2432 uses ON DELETE SET NULL for historical add-on references.
Expected behavior
Existing add-on IDs should remain stable across edits, removed children should be handled deliberately, and import results should distinguish created, reactivated, updated, and skipped records.
Acceptance criteria
- Upsert children by supplied existing ID.
- Preserve
created_at and historical references.
- Soft-deactivate removed children instead of deleting historical identities.
- Make reactivation an explicit import policy and expose separate counters.
- Add tests covering historical order snapshots, analytics joins, and soft-deleted imports.
Relevant files
main/routes/addon-groups.ts, main/routes/menu-csv.ts, main/db.ts
Summary
Editing an add-on group deletes all existing child rows and recreates them with new UUIDs. Historical normalized order snapshots retain name/price but lose their catalog
addon_idlink. CSV imports also silently reactivate soft-deleted records and report reactivated rows as created.Current behavior
main/routes/addon-groups.ts:197-226deletes and recreates every child during a group update.main/routes/menu-csv.ts:393-434reactivates groups/add-ons without separate reactivation counters.main/db.ts:2420-2432usesON DELETE SET NULLfor historical add-on references.Expected behavior
Existing add-on IDs should remain stable across edits, removed children should be handled deliberately, and import results should distinguish created, reactivated, updated, and skipped records.
Acceptance criteria
created_atand historical references.Relevant files
main/routes/addon-groups.ts,main/routes/menu-csv.ts,main/db.ts