# `Outboxer.Migration`
[🔗](https://github.com/epinault/outboxer/blob/v0.1.0/lib/outboxer/migration.ex#L1)

Creates and drops the outbox table.

Generate a migration in your application and delegate to this module:

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

      def up, do: Outboxer.Migration.up()
      def down, do: Outboxer.Migration.down()
    end

The same migration works on Postgres and SQLite.

## Options

  * `:table` - table name, default `"outboxer_messages"`. Pass the same value
    as `:table` to `Outboxer`.
  * `:prefix` - Postgres schema to create the table in.
  * `:version` - schema version to migrate to (`up/1`) or back to (`down/1`).
    Defaults to the latest for `up/1` and to `0` (nothing left) for `down/1`.
    Later releases that change the table will add versions; you then write a
    new migration calling `up(version: n)`.

## What gets created

One table and three partial indexes. The indexes that the workers use cover
only rows with `status = 'pending'`, so their size follows the backlog, not
the history.

# `down`

Migrates the outbox table down to `:version` (default: 0, dropping it).

# `up`

Migrates the outbox table up to `:version` (default: latest).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
