Skip to content

Commit

Permalink
feat(migration): add script to upgrade PostgreSQL from version 13 to 17
Browse files Browse the repository at this point in the history
  • Loading branch information
stephdl committed Feb 5, 2025
1 parent 0821fea commit 17faa74
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions imageroot/update-module.d/10migrate_postgres_to_V17
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

#
# Copyright (C) 2024 Nethesis S.r.l.
# SPDX-License-Identifier: GPL-3.0-or-later
#
# upgrade from postgres 13 to 17
# migration after https://github.com/NethServer/ns8-mattermost/releases/tag/2.1.1

set -e

if podman exec postgres-app psql --version | grep -qE " 13\.[0-9]+"; then
echo "Dumping mattermost postgres database"
podman exec postgres-app pg_dump -U mattuser --format=c mattermost > mattermost.pg_dump
echo "Stopping mattermost"
systemctl stop --user mattermost
echo "Restoring mattermost postgres database"
podman volume rm -f postgres-data
../actions/restore-module/40restore-postgres
else
echo "Postgres version is not 13, we do not need to upgrade"
fi

0 comments on commit 17faa74

Please sign in to comment.