Insert a new schedule row. Throws if a row with the same id already exists. Returns the stored row.
Delete a schedule and its trigger history.
Get a single schedule by id. Returns null if not found.
Initialize the storage domain. This should create any necessary tables/collections. Default implementation is a no-op - override in adapters that need initialization.
List schedules whose nextFireAt <= now and whose status === 'active'.
Used by the scheduler tick loop.
Optionallimit: numberList schedules matching the filter (no pagination — schedule counts are expected to stay small).
Optionalfilter: ScheduleFilterList trigger history for a schedule, newest first.
Optionalopts: ScheduleTriggerListOptionsAppend an entry to a schedule's trigger history.
Partial update of a schedule row.
Compare-and-swap update of nextFireAt. Used by the scheduler to claim
a fire before publishing — only one tick across many processes will succeed.
Returns true if the row's nextFireAt matched expectedNextFireAt and
was advanced to newNextFireAt. Returns false if another instance
already advanced it (meaning the caller should skip publishing).
The D1 schedules domain: workflow + agent schedule rows and their trigger history. Mirrors core's
SchedulesStoragecontract exactly (the abstract methodsmastra.schedulesdrives + the scheduler tick reads), so a host that composes it intocreateD1Storage({ domains })gets D1-durable schedules with no adapter change.