# `Mailglass.Migration`
[🔗](https://github.com/szTheory/mailglass/blob/v0.1.0/lib/mailglass/migration.ex#L1)

Public migration API for mailglass.

Adopters consume this via a single 8-line wrapper file that
`mix mailglass.gen.migration` (Phase 7) emits:

    defmodule MyApp.Repo.Migrations.AddMailglass do
      use Ecto.Migration
      def up, do: Mailglass.Migration.up()
      def down, do: Mailglass.Migration.down()
    end

The wrapper stays stable across mailglass versions; per-version DDL
lives in `Mailglass.Migrations.Postgres.VNN` modules, dispatched by
`Mailglass.Migrations.Postgres` tracking the current version in the
`pg_class` comment on `mailglass_events`.

Postgres-only at v0.1 per PROJECT.md (MySQL/SQLite out of scope).

# `down`
*since 0.1.0* 

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

Rolls back migrations down to the target version (default: 0).

# `migrated_version`
*since 0.1.0* 

```elixir
@spec migrated_version(keyword()) :: non_neg_integer()
```

Returns the currently-applied migration version (0 if none).

This function is safe to call outside an `Ecto.Migrator` context —
unlike `up/1` / `down/1`, it does not rely on the migration runner
process (it issues a single `pg_catalog.obj_description` query against
the configured Repo and returns an integer).

# `up`
*since 0.1.0* 

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

Runs all pending migrations up to the latest version.

---

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