mix walex.helpers (WalEx v4.8.0)

Copy Markdown View Source

Shared helpers for the walex.setup and walex.drop Mix tasks.

Wraps psql invocations and Postgrex.query!/3 calls used to bootstrap and tear down the test database, honoring the PG* environment variables for custom Postgres connection settings.

Summary

Functions

Creates the given database via psql against the postgres maintenance database.

Runs CREATE EXTENSION IF NOT EXISTS against the connected Postgrex pid.

Shells out to psql with PGHOST/PGUSER/PGPASSWORD/PGPORT taken from env or defaults.

Drops the given database via psql against the postgres maintenance database.

Functions

create_database(database_name)

Creates the given database via psql against the postgres maintenance database.

create_extension(pid, extension)

Runs CREATE EXTENSION IF NOT EXISTS against the connected Postgrex pid.

database_cmd(cmd)

Shells out to psql with PGHOST/PGUSER/PGPASSWORD/PGPORT taken from env or defaults.

drop_database(database_name)

Drops the given database via psql against the postgres maintenance database.