1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

MacOSX + homebrew環境でのPostgreSQL+PostGISのアップグレード

Posted at

9.2.4 -> 9.3.1 にアップグレードしたときのメモ。

$ brew update
$ brew upgrade

ってやったときにPostgreSQLもアップグレードされてた。
このままだと、いままのDBを引き続き使うことができないので、PostgreSQL自体だけでなく、DBをアップデートする必要がある。
PostGISも使っていたのでちょっとややこしいことになっていた。

PostgreSQL 9.2.4にスイッチする
$ brew switch postgresql 9.2.4

DB全体のダンプを作成
$ /usr/local/Cellar/postgresql/9.2.4/bin/pg_dumpall > pg_dump_2013-10-16_0.dump

古いDBのディレクトリを移動させておく
$ mv /usr/local/var/postgres /usr/local/var/postgres-old

PostgreSQL 9.3.1にスイッチする
$ brew switch postgresql 9.3.1

新しいDBを作成&初期化
$ /usr/local/Cellar/postgresql/9.3.1/bin/initdb -D /usr/local/var/postgres

さきほど作成したDBのダンプをリストアする
$ /usr/local/Cellar/postgresql/9.3.1/bin/psql -d postgres -f pg_dump_2013-10-16_0.dump

一応これで移行出来たっぽいけど大丈夫なんかな・・・。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?