chore: Category junction cleanup on location/category delete #60

Closed
opened 2026-06-28 15:36:33 +00:00 by jmiller · 2 comments
Owner

Summary

When a location or category is deleted, orphan rows remain in the #__mokosuitestorelocator_location_categories junction table. No cascade delete or cleanup logic exists.

Fix

Either:

  1. Add ON DELETE CASCADE foreign keys to the junction table
  2. Or add cleanup logic in LocationTable::delete() and CategoryTable::delete() to remove junction rows

Option 1 is preferred if the DB engine supports it (InnoDB). Option 2 is the Joomla-conventional approach using Table events.

Priority

P4 — data hygiene, no user-visible impact unless junction table grows large.

## Summary When a location or category is deleted, orphan rows remain in the `#__mokosuitestorelocator_location_categories` junction table. No cascade delete or cleanup logic exists. ## Fix Either: 1. Add `ON DELETE CASCADE` foreign keys to the junction table 2. Or add cleanup logic in `LocationTable::delete()` and `CategoryTable::delete()` to remove junction rows Option 1 is preferred if the DB engine supports it (InnoDB). Option 2 is the Joomla-conventional approach using Table events. ## Priority P4 — data hygiene, no user-visible impact unless junction table grows large.
Author
Owner

Branch created: feature/60-chore-category-junction-cleanup-on-locat

git fetch origin
git checkout feature/60-chore-category-junction-cleanup-on-locat
Branch created: [`feature/60-chore-category-junction-cleanup-on-locat`](https://git.mokoconsulting.tech/MokoConsulting/MokoSuiteStoreLocator/src/branch/feature/60-chore-category-junction-cleanup-on-locat) ```bash git fetch origin git checkout feature/60-chore-category-junction-cleanup-on-locat ```
Author
Owner

Fixed:

  • LocationTable::delete() — cleans up location_categories junction rows where location_id matches
  • CategoryTable::delete() — cleans up location_categories junction rows where category_id matches
  • Uses Joomla Table override pattern: parent::delete() first, then junction cleanup
Fixed: - `LocationTable::delete()` — cleans up `location_categories` junction rows where `location_id` matches - `CategoryTable::delete()` — cleans up `location_categories` junction rows where `category_id` matches - Uses Joomla Table override pattern: parent::delete() first, then junction cleanup
Sign in to join this conversation.