# `PgFlow.Migrations.Versions.V04`
[🔗](https://github.com/agoodway/pgflow/blob/v0.3.1/lib/pgflow/migrations/versions/v04.ex#L1)

PgFlow extensions migration version 4.

Narrows `recover_stalled_tasks/1` to tasks `pgflow.start_tasks` could actually
dispatch again: the run must be `started` and the task's `step_states` row must
be `started`.

Without the step-state guard, a map step that skips via `when_exhausted`
strands its siblings in `started` — `fail_task` archives their messages but
never terminalizes the task rows — and the sweep requeued those orphans on an
already-completed run. See
`priv/pgflow_helpers/sql/versions/v04/v04_up.sql` for the full rationale.

# `down`

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

Rolls back this version's migration by executing the down SQL file.

# `up`

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

Applies this version's migration by executing the up SQL file.

---

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