diff --git a/tools.func.md b/tools.func.md index 819c221..416900e 100644 --- a/tools.func.md +++ b/tools.func.md @@ -46,5 +46,34 @@ If the requested module version is already installed, it is skipped. Modules are updated if the installed version does not match the requested one (unless latest is used). On failure, the script exits with exit 1. +## 🐘 `install_postgresql` + +### Overview + +This function installs or upgrades to a specified version of PostgreSQL. It handles backups, repository configuration, and service restarts automatically. + +### Usage + +```bash +# Install default PostgreSQL version +install_postgresql + +# Install a specific version +PG_VERSION=15 install_postgresql +``` + +### User-Configurable Variables + +| Variable | Description | Default Value | +|--------------|-----------------------------------------------------------------------------|---------------| +| `PG_VERSION` | Specifies the major version of PostgreSQL to install or upgrade to (e.g., `14`, `15`, `16`). | `16` | + +### Behavior + +- Backs up databases if an existing installation is detected. +- Installs the required version of PostgreSQL using the PGDG APT repo. +- Restores the database after upgrade if applicable. + +---