1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| # 將 SQLite 換成 Postgresql - 進入終端 heroku console
- 找出 Database DSN String ENV['DATABASE_URL']
- 格式解說 "postgres://username:password@hostname/database"
- 修改 config/database.yml
production: adapter: postgresql encoding: unicode username: username port: 5432 host: hostname database: database password: password - 修改 Gemfile 檔案 (Production: postgresql, Development: sqlite)
group :production do gem 'pg' end group :development, :test do gem 'sqlite3' end
- 重新執行 bundler RAILS_ENV=production bundle - 提交 git add Gemfile git add Gemfile.lock git add config/database.yml git commit -m 'updated production to postgresql' git push heroku
|