mix orkestra.projection.rebuild (orkestra v0.2.0)

Copy Markdown View Source

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.OrderProjector

Options

Rebuild sequence

  1. Stop the projector GenServer via Supervisor.terminate_child/2.
  2. Roll back all projection migrations.
  3. Re-run all migrations.
  4. Delete checkpoint and dead-letter rows (projector starts from position 0).
  5. 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).