summaryrefslogtreecommitdiff
path: root/bin/upgrad_pg.sh
blob: ccdfbccaaf31e09dfa9ff8e7d1e1b553ebd27339 (plain)
1
2
3
4
5
6
7
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"