shg25 / rnsite

raisyumo-nanitozo!!
Apache License 2.0
0 stars 0 forks source link

PostgreSQLのバージョンアップ時のエラー対応 #115

Closed shg25 closed 1 year ago

shg25 commented 2 years ago

111 の対応時に画面上にcould not connect to server: No such file or directory的なエラーが発生

cat /usr/local/var/log/postgres.log | tail -100で以下の表示を確認

FATAL:  database files are incompatible with server DETAIL:
The data directory was initialized by PostgreSQL version 13, which is not compatible with this version 14.1.

brew postgresql-upgrade-databaseで解消 その前にbrew cleanup postgresqlをしてもいいのかもしれない

shg25 commented 2 years ago

Herokuの場合にどうなるか相談してみる

shg25 commented 2 years ago

相談したメモ

shg25 commented 2 years ago

バージョン確認

$ heroku pg:info --app [アプリ名]

Herokuアップグレードの記事を確認 https://devcenter.heroku.com/ja/articles/upgrading-heroku-postgres-databases

現状、Hobby-devプランなのでupgradeじゃなくてcopy? というかcopyでバージョンが上がる…? 引き続き確認

shg25 commented 2 years ago

確認

→ どちらにしろローカルDBの単純なアップデートとは違って新しいDBのインスタンス的なものを作成してメンテナンスモードにしてデータを移行?

相談

→ 相談して次の課題にやるべきことをメモる

shg25 commented 1 year ago

相談したところ、前のコメントの認識通り。 プラン変更と同じく新しいDBを作って、そこに既存をコピー→新規DBにプロモートという手順でOK

そして直近はHeroku無料プラン終了に伴って別プラン変更のために新規DBを作成するので、そちらで対応することになる予定。 有料プランにした後はupgradeでもいけるかもだけど、新規作って試すほうがリスクが少なく感じる。