# `mix phoenix_micro.gen.migration`
[🔗](https://github.com/iamkanishka/phoenix_micro/blob/v1.0.0/lib/mix/tasks/phoenix_micro.gen.migration.ex#L1)

Generates the `outbox_messages` table migration required by
`PhoenixMicro.Outbox`.

## Usage

    mix phoenix_micro.gen.migration

## Options

    --repo MODULE     Ecto repo module (default: inferred from Mix project)
    --table NAME      Table name (default: outbox_messages)
    --no-index        Skip creating indexes

## What it generates

A timestamped migration file in `priv/repo/migrations/` that creates:

- `outbox_messages` table with UUID primary key
- Columns: topic, payload (jsonb), headers (jsonb), attempt, relayed_at,
  failed_at, last_error, inserted_at, updated_at
- Index on `(relayed_at, inserted_at)` for efficient relay polling
- Index on `failed_at` for DLQ monitoring queries
- Uses `gen_random_uuid()` for Postgres UUID generation

---

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