Orkestra.Projection.Migration (orkestra v0.2.0)

Copy Markdown View Source

Creates and drops Orkestra's internal projection tables.

This module follows the Oban-style library migration pattern: Orkestra defines the DDL internally, and the consuming application generates a thin wrapper migration that delegates to up/0 and down/0.

Usage

Generate a migration in your application:

mix ecto.gen.migration create_orkestra_projection_tables

In the generated migration file, delegate to this module:

defmodule MyApp.Repo.Migrations.CreateOrkestraProjectionTables do
  use Ecto.Migration

  def up, do: Orkestra.Projection.Migration.up()
  def down, do: Orkestra.Projection.Migration.down()
end

Then run:

mix ecto.migrate

Tables

  • projection_checkpoints — one row per projector; tracks last_position and halt status (halted, halted_at). Unique index on projector_name.
  • projection_dead_letters — one row per parked event; carries the six ERR-02 fields. Indexed on projector_name and (projector_name, position).

Summary

Functions

Drops the projection_dead_letters and projection_checkpoints tables.

Creates the projection_checkpoints and projection_dead_letters tables.

Functions

down()

@spec down() :: term()

Drops the projection_dead_letters and projection_checkpoints tables.

up()

@spec up() :: term()

Creates the projection_checkpoints and projection_dead_letters tables.