Chronicle.Ecto.Migration (chronicle v0.1.1)

Copy Markdown

Reusable Ecto migration for the default audit store.

Create a migration in the host application:

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

  def up, do: Chronicle.Ecto.Migration.up()
  def down, do: Chronicle.Ecto.Migration.down()
end

The functions accept :prefix, :events_table, :ledger_heads_table, and :ledger_entries_table.

Groups and events share one table. A group root is a row with kind = "group" carrying the unit's type, outcome, timing, and child count; its children are rows with kind = "event" whose group_id points back at it.

Summary

Functions

down(opts \\ [])

@spec down(keyword()) :: :ok

up(opts \\ [])

@spec up(keyword()) :: :ok