If you find that your Postgres data is inaccessible after upgrading, you can use these steps.
- Log into your server as an administrator.
- Open Terminal and use the following command.
sudo serveradmin stop postgres
- Edit /Library/Server/PostgreSQL/Config/org.postgresql.postgres.plist and change unix_socket_directory to unix_socket_directories.
- Use the following commands in Terminal:
sudo mv /Library/Server/PostgreSQL/Data /Library/Server/PostgreSQL/DataOld
sudo -u _postgres /Applications/Server.app/Contents/ServerRoot/usr/bin/initdb --encoding UTF8 --locale=C -D /Library/Server/PostgreSQL/Data
sudo -u _postgres /Applications/Server.app/Contents/ServerRoot/usr/bin/pg_upgrade -b /Applications/Server.app/Contents/ServerRoot/usr/libexec/postgresql9.2 -B /Applications/Server.app/Contents/ServerRoot/usr/bin -d /Library/Server/PostgreSQL/DataOld -D /Library/Server/PostgreSQL/Data
sudo launchctl load -w /Applications/Server.app/Contents/ServerRoot/System/Library/LaunchDaemons/org.postgresql.postgres.plist
sudo serveradmin start postgres
Once you’ve made sure that all of your data was successfully migrated, you can remove /Library/Server/PostgreSQL/DataOld.
Note: The Postgres database used by OS X Server is only intended for use with service data used by the system. Avoid adding custom content to this database. If you’d like to run Postgres on your OS X Server, you should download and install your own instance.