Skip to content

A free open source IT asset/license management system

Fixed calendar migration for folks with a ton of soft-deleted entries

snipe273777c5e4bd
diff --git a/database/migrations/2026_10_07_220000_soft_delete_calendar_events_for_trashed_sources.php b/database/migrations/2026_10_07_220000_soft_delete_calendar_events_for_trashed_sources.php
index a376cd47bd..75b2a5e5fa 100644
--- a/database/migrations/2026_10_07_220000_soft_delete_calendar_events_for_trashed_sources.php
+++ b/database/migrations/2026_10_07_220000_soft_delete_calendar_events_for_trashed_sources.php
@@ -42,10 +42,15 @@ return new class extends Migration
continue;
}
- CalendarEvent::query()
- ->where('source_type', $sourceClass)
- ->whereIn('source_id', $trashedIds)
- ->delete();
+ // Chunk the IN list so an install with thousands of trashed
+ // sources doesn't blow MySQL's prepared-statement placeholder
+ // ceiling
+ foreach (array_chunk($trashedIds, 1000) as $chunk) {
+ CalendarEvent::query()
+ ->where('source_type', $sourceClass)
+ ->whereIn('source_id', $chunk)
+ ->delete();
+ }
}
}