Workflows
Events Cleanup
Periodic cleanup of stale event data to maintain database performance.
Events Cleanup Workflow
The Events Cleanup workflow is a maintenance workflow that periodically removes old event records from the database to keep storage lean and query performance fast.
How It Works
- Read Retention Policy — Accepts a configurable retention period (default: 90 days)
- Delete Old Events — Removes all events older than the retention window from PostgreSQL
- Report Results — Returns count of deleted events and the retention period used
Input Schema
{
retentionDays?: number; // Default: 90
}Output
{
deletedCount: number; // Number of events deleted
retentionDays: number; // Retention period used
}Graceful Degradation
If the database is unreachable (e.g., running in agent-only context), the workflow logs a warning and returns deletedCount: 0 instead of crashing.
Scheduling
Runs automatically via Inngest cron job. Not typically invoked manually.