mix pgflow.setup (PgFlow v0.1.0)

Copy Markdown View Source

Generates an Ecto migration in the consumer app that installs the pgflow schema by calling PgFlow.Migration.up/0 and PgFlow.HelpersMigration.up/0 (and optionally PgFlowDashboard.Migration.up/0) in the correct order.

This mirrors mix tango.setup and mix good_analytics.setup. The output is a single wrapper migration, not per-statement migrations — SQL is vendored inside pgflow.

Usage

mix pgflow.setup
mix pgflow.setup --repo MyApp.OtherRepo
mix pgflow.setup --no-helpers
mix pgflow.setup --dashboard

Options

  • --repo - Ecto repo module to install against. Defaults to the first entry in config :my_app, ecto_repos: [...].

  • --no-helpers - Skip PgFlow.HelpersMigration (Elixir-binding SQL helpers: worker registration, flow input/output queries). Default: helpers are installed.

  • --dashboard - Also install PgFlowDashboard.Migration (dashboard views). Default: skipped. Add this if you use the PgFlow LiveView dashboard.

Prerequisites

Before mix ecto.migrate picks up the generated migration, the consumer must have:

  • pgmq installed (run mix pgflow.gen.pgmq_migration to generate a migration that installs pgmq via SQL-only method — required unless your Postgres already provides pgmq, e.g. Supabase).
  • pg_cron extension registered (CREATE EXTENSION pg_cron in an earlier migration).
  • citext, pg_trgm, pgcrypto extensions registered.

The typical migration order is:

  1. install_extensions (citext, pg_trgm, pgcrypto, pg_cron)
  2. install_pgmq (from mix pgflow.gen.pgmq_migration)
  3. setup_pgflow (this task)