fix: add cleanup triggers for orphaned conditions

When a regex or language is deleted, the FK cascade deletes the
condition_patterns/condition_languages row but leaves the parent
condition orphaned. These triggers clean up the parent condition.
This commit is contained in:
Sam Chau
2026-02-11 02:36:34 +10:30
parent 29557fdfe8
commit 00bca26d38
3 changed files with 27 additions and 1 deletions
+7
View File
@@ -108,3 +108,10 @@ instead of an autoincrement id column.
- `radarr_naming.name`, `sonarr_naming.name`, `radarr_media_settings.name`, `sonarr_media_settings.name`
- SQLite PRIMARY KEY doesn't imply NOT NULL for non-INTEGER columns; explicit declaration needed for type generators
## 10-2-26
- Added cleanup triggers for orphaned conditions
- `trg_condition_patterns_cleanup`: when a `condition_patterns` row is cascade-deleted (e.g., referenced regex deleted upstream), the parent condition in `custom_format_conditions` is also deleted
- `trg_condition_languages_cleanup`: same for `condition_languages` when a referenced language is deleted
- Prevents orphaned conditions that exist without their type-specific data