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

Generates an Ecto migration that installs PgFlowDashboard.

## Usage

    mix pgflow_dashboard.gen.migration
    mix pgflow_dashboard.gen.migration --migrations-path priv/repo/migrations

## Options

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

## Generated Objects

This migration creates the `pgflow_dashboard` PostgreSQL schema with:

### Views

  * `runs_with_progress` - Runs with calculated progress percentage
  * `workers_with_load` - Workers with current load metrics
  * `flow_stats` - Flow-level statistics (24h)
  * `step_states_with_tasks` - Step states with task counts

### Functions

  * `get_overview_metrics()` - Returns dashboard overview metrics
  * `list_runs(...)` - Paginated run listing with filters
  * `list_workers(...)` - Paginated worker listing with filters
  * `list_flows(...)` - Flow statistics

## Requirements

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

## Versioning

PgFlowDashboard uses versioned migrations. When you upgrade the library,
running migrations again will automatically apply any new versions.
The current version is tracked via PostgreSQL comments.

## Example

    # Generate the migration
    $ mix pgflow_dashboard.gen.migration

    # Run the migration
    $ mix ecto.migrate

---

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