我需要通過遷移將屬性/列添加到Heroku.com(Rails應用程序)上的生產數據庫(Postgre)中的表中。 當我進行遷移時,它看起來沒問題,但是當我查看錶格中的列時,它沒有添加列!Uable在postgre數據庫上運行heroku上的遷移
我的開發數據庫是sqlite3的和生產DB是postgre
我做到以下幾點:
heroku run rails generate migration AddUtc_OffsetToEvents utc_offset:integer RAILS_ENV=production --app app-name-1111
,並返回:
invoke active_record
create db/migrate/20130304070946_add_utc_offset_to_events.rb
然後我跑遷移
heroku run rake db:migrate RAILS_ENV=production --app app-name-1111
然後:
heroku restart
當我運行
heroku pg:psql HEROKU_POSTGRESQL_GRAY_URL --app app-name-1111
和檢查表的列:
\d+ events
它仍然不具備utc_offset列,並沒有錯誤持續顯示同時執行之前的cmds。
任何想法或提示?
遷移文件的內容是什麼?你爲什麼要在生產中創建遷移?你應該先在開發中做到這一點。 – 2013-03-04 14:27:54
內容遷移的:'類AddUtcOffsetToEvents
jacob
2013-03-04 15:12:26
你可以嘗試沒有'RAILS_ENV =生產'?這可能會在解析命令時搞亂Toolbelt。無論如何,在這種情況下'RAILS_ENV = production'將自動完成。 'heroku運行rake db:migrate --app app-name-1111' – catsby 2013-03-04 17:19:46