Baton.Migration (Baton v0.1.0)

Copy Markdown View Source

Installs and updates Baton's database schema.

Like Oban, Baton ships its tables as a versioned migration the host invokes from its own migration file:

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

  def up,   do: Baton.Migration.up(version: 1)
  def down, do: Baton.Migration.down(version: 1)
end

Future schema changes ship as higher versions; bumping the version: and running mix ecto.migrate upgrades in place. Calls are idempotent (create_if_not_exists), so re-running is safe.

Options

  • :version — target schema version (default: latest)
  • :prefix — Postgres schema prefix (matches your Oban prefix, if any)

Tables

  • workflow_nodes — workflow membership, dependencies, and step results
  • workflow_step_stats — per-step LLM token/cost stats (optional feature)
  • workflow_debug_logs — captured request/response payloads (optional feature)
  • workflow_completions — one row per finished workflow; the claim that makes the terminal {:workflow_finished, _} notification fire exactly once (v2)

Summary

Functions

Roll back down to :version (default: remove everything).

Migrate up to :version (default: latest).

Functions

down(opts \\ [])

Roll back down to :version (default: remove everything).

up(opts \\ [])

Migrate up to :version (default: latest).