summaryrefslogtreecommitdiff
path: root/bin/upgrad_pg.sh
diff options
context:
space:
mode:
Diffstat (limited to 'bin/upgrad_pg.sh')
-rwxr-xr-xbin/upgrad_pg.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/bin/upgrad_pg.sh b/bin/upgrad_pg.sh
new file mode 100755
index 0000000..ccdfbcc
--- /dev/null
+++ b/bin/upgrad_pg.sh
@@ -0,0 +1,8 @@
+FROM_VERSION="$1"
+
+pacman -S --needed postgresql-old-upgrade
+chown postgres:postgres /var/lib/postgres/
+su - postgres -c "mv /var/lib/postgres/data /var/lib/postgres/data-${FROM_VERSION}"
+su - postgres -c 'mkdir /var/lib/postgres/data'
+su - postgres -c "initdb --locale $LANG -E UTF8 -D /var/lib/postgres/data"
+su - postgres -c "pg_upgrade -b /opt/pgsql-${FROM_VERSION}/bin/ -B /usr/bin/ -d /var/lib/postgres/data-${FROM_VERSION} -D /var/lib/postgres/data"