View Source Medic.Checks.Postgres (Medic v1.7.2)
Checks that Postgres is running, and is set up correctly.
examples
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.
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
@spec correct_data_directory?(Path.t() | list()) :: 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.
If run with one argument, the argument can be:
- A path to the data directory, or
- A keyword list with one or more of the following keys:
data_directory
: the path to the data directoryremedy
: the remedy as a string
usage
Usage
{Medic.Checks.Postgres, :correct_data_directory?}
{Medic.Checks.Postgres, :correct_data_directory?, ["/path/to/data/directory"]}
{Medic.Checks.Postgres, :correct_data_directory?, [data_directory: "/path/to/data/directory", remedy: "bin/dev/db-restart"]}
@spec correct_version_running?() :: Medic.Check.check_return_t()
Checks that the running Postgres database matches the version defined
in ASDF's .tool-versions
file.
@spec database_exists?(binary()) :: Medic.Check.check_return_t()
Checks that the named database exists in the running Postgres instance.
usage
Usage
{Medic.Checks.Postgres, :database_exists?, ["my_db_dev"]}
@spec role_exists?() :: Medic.Check.check_return_t()
Checks that a user postgres
has been created in the running instance.
@spec running?(list()) :: Medic.Check.check_return_t()
Checks whether Postgres is running, by attempting to list all databases.
Options:
remedy
: the remedy as a string