BullMQ.Backends.Postgres.SqlLoader (BullMQ v2.0.2)

View Source

Loads the PostgreSQL backend's SQL from .sql files — the portable source of truth shared with the Node.js/Python/other ports.

Runtime queries live under postgres/commands/ (each file is one parameterized SELECT fn(...) or direct statement); schema migrations live under postgres/migrations/. The files contain no schema/namespace references — the connection's search_path selects the schema — so they are portable verbatim.

Like BullMQ.Scripts (which prefers priv/scripts and falls back to the repo's rawScripts), this loader prefers priv/postgres and falls back to the shared src/postgres tree during local development. Results are cached in :persistent_term after the first read.

Summary

Functions

Returns the base directory the SQL is loaded from (priv or src).

Loads a runtime command's SQL by name (without the .sql extension).

Loads a migration's SQL by file name (with the .sql extension).

Functions

base_dir()

@spec base_dir() :: String.t()

Returns the base directory the SQL is loaded from (priv or src).

load_command(name)

@spec load_command(String.t()) :: String.t()

Loads a runtime command's SQL by name (without the .sql extension).

load_migration(file)

@spec load_migration(String.t()) :: String.t()

Loads a migration's SQL by file name (with the .sql extension).