# `PgFlow.Queries.Pgmq`
[🔗](https://github.com/agoodway/pgflow/blob/v0.1.0/lib/pgflow/queries/pgmq.ex#L1)

SQL query interface for pgmq-specific operations.

Provides functions for managing pgmq NOTIFY triggers and querying
pgmq extension metadata.

# `disable_notify_insert`

```elixir
@spec disable_notify_insert(module(), String.t()) :: :ok | {:error, term()}
```

Disables NOTIFY triggers for a pgmq queue.

Calls `pgmq.disable_notify_insert/1` to remove the INSERT trigger
that fires NOTIFY events when messages are added to the queue.

# `enable_notify_insert`

```elixir
@spec enable_notify_insert(module(), String.t(), non_neg_integer()) ::
  :ok | {:error, term()}
```

Enables NOTIFY triggers for a pgmq queue.

Calls `pgmq.enable_notify_insert/2` to add an INSERT trigger
that fires NOTIFY events when messages are added to the queue.
The `throttle_ms` parameter controls how frequently notifications fire.

# `get_pgmq_version`

```elixir
@spec get_pgmq_version(module()) ::
  {:ok, String.t()} | {:error, :not_installed | term()}
```

Gets the installed pgmq version.

Checks two sources in order:
1. `pg_extension` catalog — works when pgmq is installed via `CREATE EXTENSION pgmq`
2. Feature detection — checks for the `enable_notify_insert` function in the `pgmq` schema,
   which indicates pgmq >= 1.8.0 installed from a SQL dump (e.g., on Neon or other managed Postgres)

Returns `{:ok, version}` if pgmq is detected, or `{:error, :not_installed}` if not.

---

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