mix ash_workflow.backfill_transition_log (AshWorkflow v0.6.0)

Copy Markdown View Source

Seeds an approximate :initial transition-log row for existing records.

For every record of the given workflow resource that has no rows in its transition_log, inserts one row built from the record's current state and state_entered_at:

transition_name: :initial
triggered_by: :initial
from_state: nil
to_state: record's current state
occurred_at: record's current state_entered_at

Idempotent: a record that already has at least one log row is left alone, so running this task twice never doubles the seeded rows.

History from before the log was enabled is not recoverable. This is a starting point, not real history — see the "Limits" section of the workflow-history guide.

Example

mix ash_workflow.backfill_transition_log MyApp.Ticket