Schedule-trigger TTL cleanup: deletes trigger-history
rows from mastra_schedule_triggers once their actualFireAt is older than the
TTL, at the storage layer so a cron reaps them without a live tick — the same
posture as the other purges (raw D1 binding, failure-isolated as a cron duty).
actualFireAt is stored as INTEGER ms-epoch (core types
ScheduleTrigger.actualFireAt as number, unlike the ISO-TEXT timestamp
columns the other domains use), so the comparison is a NUMERIC < against a
numeric cutoff — a correct timestamp comparison over integers. A missing table
reads as zero (schedules may never have fired). Scheduling stays with the
caller. Deleting trigger history never touches a live schedule (its own row is
in mastra_schedules), so there is no ordering constraint.
Schedule-trigger TTL cleanup: deletes trigger-history rows from
mastra_schedule_triggersonce theiractualFireAtis older than the TTL, at the storage layer so a cron reaps them without a live tick — the same posture as the other purges (raw D1 binding, failure-isolated as a cron duty).actualFireAtis stored as INTEGER ms-epoch (core typesScheduleTrigger.actualFireAtasnumber, unlike the ISO-TEXT timestamp columns the other domains use), so the comparison is a NUMERIC<against a numeric cutoff — a correct timestamp comparison over integers. A missing table reads as zero (schedules may never have fired). Scheduling stays with the caller. Deleting trigger history never touches a live schedule (its own row is inmastra_schedules), so there is no ordering constraint.