Last active
December 25, 2015 04:49
-
-
Save madssj/6920108 to your computer and use it in GitHub Desktop.
A shell script to upgrade between versions of PostgreSQL on Debian. Use at your own risk.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ $# -ne 2 ] | |
then | |
echo "Usage: $0 <from> <to>" | |
exit 1 | |
fi | |
from=$1 | |
to=$2 | |
for s in $from $to | |
do | |
ln -s /etc/postgresql/$s/main/*.conf /var/lib/postgresql/$s/main/ | |
done | |
/usr/lib/postgresql/$to/bin/pg_upgrade \ | |
-k \ | |
-b /usr/lib/postgresql/$from/bin \ | |
-B /usr/lib/postgresql/$to/bin \ | |
-d /var/lib/postgresql/$from/main/ \ | |
-D /var/lib/postgresql/$to/main/ | |
for s in $from $to | |
do | |
rm -f /var/lib/postgresql/$s/main/*.conf | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment