From 6f358d7e5d0b59203da9b39accb65b1292d82dcd Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Mon, 5 Jan 2026 15:15:59 +0100 Subject: [PATCH] Add PostGIS extension check to Reitti update_script Automatically enable PostGIS extension on existing installations if missing. Checks if extension is already enabled before attempting to create it. Fixes existing Reitti installations that were created before PostGIS was added to the initial setup (commit b6312b87d). Users no longer need to manually run 'CREATE EXTENSION postgis;' --- ct/reitti.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ct/reitti.sh b/ct/reitti.sh index 3f80a35f1..b8bf42d3e 100644 --- a/ct/reitti.sh +++ b/ct/reitti.sh @@ -28,6 +28,15 @@ function update_script() { exit fi + # Enable PostGIS extension if not already enabled + if systemctl is-active --quiet postgresql; then + if ! sudo -u postgres psql -d reitti -tAc "SELECT 1 FROM pg_extension WHERE extname='postgis'" 2>/dev/null | grep -q 1; then + msg_info "Enabling PostGIS extension" + sudo -u postgres psql -d reitti -c "CREATE EXTENSION IF NOT EXISTS postgis;" &>/dev/null + msg_ok "Enabled PostGIS extension" + fi + fi + if [ ! -d /var/cache/nginx/tiles ]; then msg_info "Installing Nginx Tile Cache" mkdir -p /var/cache/nginx/tiles