# `GeoGenius.Migration`
[🔗](https://github.com/agoodway/geo_genius/blob/main/lib/geo_genius/migration.ex#L1)

Versioned GeoGenius schema migrations for host applications.

Host migrations pin both the target version and the PostgreSQL prefix.

# `contract_status`

```elixir
@spec contract_status(module(), String.t()) :: map()
```

Inspects an installed schema's version, contract marker, signatures, and capabilities.

# `current_contract_revision`

```elixir
@spec current_contract_revision() :: String.t()
```

Returns the content-addressed identity of the schema contract shipped by this package.

# `current_version`

```elixir
@spec current_version() :: pos_integer()
```

Returns the current migration version supported by this library.

# `down`

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

Rolls back migrations to the target version.

## Options

  * `:prefix` - Schema prefix. Defaults to `"geo_genius"`.
  * `:version` - Target version to roll back to. Defaults to `0`.

# `installed_version`

```elixir
@spec installed_version(module(), String.t()) :: non_neg_integer()
```

Returns the installed GeoGenius schema version for `prefix`, read directly
through `repo`.

Unlike `migrated_version/1` (usable only from inside an active
`Ecto.Migration` run, since it resolves its repo from the migration
process), this takes an explicit repo and works from ordinary application
or mix task code.

Returns `0` if GeoGenius has not been installed at `prefix`.

# `migrated_version`

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

Returns the currently migrated version from the database.

Returns `0` if no migrations have been applied.

# `render_sql`

```elixir
@spec render_sql(keyword()) :: String.t()
```

Renders a deterministic SQL transition for hosts that do not run Ecto migrations.

# `required_capabilities`

```elixir
@spec required_capabilities() :: [String.t()]
```

Returns the explicit capabilities required by the current schema contract.

# `up`

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

Applies migrations up to the target version.

## Options

  * `:prefix` - Schema prefix. Defaults to `"geo_genius"`.
  * `:version` - Target version. Defaults to `2`.

---

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