Medic.Checks.Postgres (Medic v1.5.1) View Source

Checks that Postgres is running, and is set up correctly.

Examples

{Check.Postgres, :running?},
{Check.Postgres, :correct_version_running?},
{Check.Postgres, :role_exists?},
{Check.Postgres, :correct_data_directory?},
{Check.Postgres, :database_exists?, ["my_db"]}

Link to this section Summary

Functions

Checks that the running instance of Postgres has the expected data directory. If run with no arguments, this expects that the data directory is located at .priv/postgres/data within the current project.

Checks that the running Postgres database matches the version defined in ASDF's .tool-versions file.

Checks that the named database exists in the running Postgres instance.

Checks that a user postgres has been created in the running instance.

Checks whether Postgres is running, by attempting to list all databases.

Link to this section Functions

Link to this function

correct_data_directory?(path \\ "./priv/postgres/data")

View Source

Specs

correct_data_directory?(Path.t()) :: Medic.Check.check_return_t()

Checks that the running instance of Postgres has the expected data directory. If run with no arguments, this expects that the data directory is located at .priv/postgres/data within the current project.

Usage

{Medic.Checks.Postgres, :correct_data_directory}
{Medic.Checks.Postgres, :correct_data_directory, ["/path/to/data/directory"]}
Link to this function

correct_version_running?()

View Source

Specs

correct_version_running?() :: Medic.Check.check_return_t()

Checks that the running Postgres database matches the version defined in ASDF's .tool-versions file.

Link to this function

database_exists?(database_name)

View Source

Specs

database_exists?(binary()) :: Medic.Check.check_return_t()

Checks that the named database exists in the running Postgres instance.

Usage

{Medic.Checks.Postgres, :database_exists?, ["my_db_dev"]}

Specs

role_exists?() :: Medic.Check.check_return_t()

Checks that a user postgres has been created in the running instance.

Specs

running?() :: Medic.Check.check_return_t()

Checks whether Postgres is running, by attempting to list all databases.