運用環境での migration

UsingMigrations - RoR Wiki 翻訳 Wiki を参考に

 % rake --trace environment RAILS_ENV=production migrate
 (in /work2/Dr.WEB/rails/drweb_intra)
 ** Invoke environment (first_time)
 ** Execute environment
 ** Invoke migrate (first_time)
 ** Invoke db:migrate (first_time)
 ** Invoke environment 
 ** Execute db:migrate
 == ColumnNumberForOrder: migrating ============================================
 -- add_column(:products, :number_for_order, :integer, {:default=>999, :null=>false})
    -> 0.0214s
 -- add_column(:licenses, :number_for_order, :integer, {:default=>999, :null=>false})
    -> 0.0087s
 -- add_column(:os_distros, :number_for_order, :integer, {:default=>999, :null=>false})
    -> 0.0130s
 == ColumnNumberForOrder: migrated (0.0511s) ===================================

 ** Invoke db:schema:dump (first_time)
 ** Invoke environment 
 ** Execute db:schema:dump
 ** Execute migrate
 %

できた :)。environment パラメータで環境変数を指定するのがミソなんですね。参考になりました。