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

Generates an Ecto migration that installs PgFlow's extension SQL functions.

## Usage

    mix pgflow.gen.helpers_migration
    mix pgflow.gen.helpers_migration --migrations-path priv/repo/migrations

## Options

  * `--migrations-path` - Path to the migrations directory.
    Defaults to `priv/repo/migrations`.

## Generated Functions

This migration creates PostgreSQL functions in the `pgflow` schema:

### Read Functions
  * `get_flow_input(uuid)` - Get flow run input data
  * `flow_exists(text)` - Check if flow exists
  * `get_step_output(uuid, text)` - Get step output

### Write Functions
  * `register_worker(uuid, text, text)` - Register or heartbeat a worker
  * `mark_worker_stopped(uuid)` - Mark worker as stopped
  * `recover_stalled_tasks(double precision)` - Recover stalled tasks

## Requirements

The pgflow schema must already exist. Run pgflow migrations first if needed.

## Example

    # Generate the migration
    $ mix pgflow.gen.helpers_migration

    # Run the migration
    $ mix ecto.migrate

---

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