# `PgFlow.HelpersMigration`
[🔗](https://github.com/agoodway/pgflow/blob/v0.1.0/lib/pgflow/helpers_migration.ex#L1)

Manages database migrations for PgFlow's extension SQL functions.

These functions wrap custom queries (worker registration, stalled task recovery, etc.)
as PostgreSQL functions in the `pgflow` schema, called via RPC from `PgFlow.Queries.*` modules.

## Usage in Ecto Migrations

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

      def up, do: PgFlow.HelpersMigration.up()
      def down, do: PgFlow.HelpersMigration.down()
    end

# `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 `"pgflow"`.
  * `:version` - Target version to roll back to. Defaults to `0`.

# `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.

# `up`

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

Applies migrations up to the target version.

## Options

  * `:prefix` - Schema prefix. Defaults to `"pgflow"`.
  * `:version` - Target version. Defaults to `1`.

---

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