From 02d742e3939ec7f49d447245ca2fd1f932bbc092 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> Date: Thu, 15 May 2025 11:58:14 +0200 Subject: [PATCH] Updated tools.func (markdown) --- tools.func.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) 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. + +---