Update postgres: Unterschied zwischen den Versionen

Aus Laemmi´s Wiki
Zur Navigation springen Zur Suche springen
 
Zeile 9: Zeile 9:
 
== Init new DB ==
 
== Init new DB ==
 
  initdb /usr/local/var/postgres/
 
  initdb /usr/local/var/postgres/
  /usr/local/opt/postgresql/bin/initdb --locale=de_DE.UTF-8 -D /usr/local/var/postgres -E utf8
+
/usr/local/opt/postgresql/bin/initdb --locale=de_DE.UTF-8 -D /usr/local/var/postgres -E utf8
  
 
== Stop ==
 
== Stop ==

Aktuelle Version vom 21. Dezember 2018, 12:27 Uhr

Check

brew info postgresql
psql --version

Backup

mv /usr/local/var/postgres/ /usr/local/var/postgres.x.x.backup/

Init new DB

initdb /usr/local/var/postgres/
/usr/local/opt/postgresql/bin/initdb --locale=de_DE.UTF-8 -D /usr/local/var/postgres -E utf8

Stop

launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
rm ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
pg_ctl -D /usr/local/var/postgres stop -m fast
pg_ctl -D /usr/local/var/postgres.x.x.backup stop -m fast

Upgrade

pg_upgrade -b /usr/local/Cellar/postgresql/x.old/bin/ -B /usr/local/Cellar/postgresql/x.new/bin/ -d /usr/local/var/postgres.x.x.backup/ -D /usr/local/var/postgres

Restart

ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist