summaryrefslogtreecommitdiff
path: root/bin/upgrad_pg.sh
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2020-02-16 15:57:40 -0500
committerluxagraf <sng@luxagraf.net>2020-02-16 15:57:40 -0500
commit2a9538f7711dcea71ba5702ca94a9d9c00287ea4 (patch)
treee0fe5ea7c909b01e10bf6a8dd4abcb619b6924c9 /bin/upgrad_pg.sh
parent3165ef5abdb298108efa2ba3d339f70ca966315a (diff)
added the rest of bin
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"