Rebuilds a projection by stopping its GenServer, rolling back and re-running all migrations, resetting the checkpoint, and restarting the GenServer. The projector then replays the full event stream from position 0, transitioning to live automatically once caught up.
Requires the projector to be running under Orkestra.Projection.Supervisor.
If the projector uses a custom supervision tree, stop and restart it manually.
Usage
mix orkestra.projection.rebuild MyApp.OrderProjectorOptions
--yes- Skip confirmation prompt (for scripting/CI).--supervisor- Supervisor name (default:Orkestra.Projection.Supervisor).
Rebuild sequence
- Stop the projector GenServer via
Supervisor.terminate_child/2. - Roll back all projection migrations.
- Re-run all migrations.
- Delete checkpoint and dead-letter rows (projector starts from position 0).
- Restart the GenServer via
Supervisor.restart_child/2.
After restart, the GenServer subscribes from position -1 (no checkpoint) and replays all events in order, then transitions to live automatically (RBLD-02 — gap-free replay, no special rebuild path needed).