I have this table:
class CreateShoes < ActiveRecord::Migration
def change
create_table :shoes do |t|
t.string :name
t.boolean :leather
Run in your console:
$ rails g migration rename_season_to_season_id
Now file db/migrate/TIMESTAMP_rename_season_to_season_id.rb
contains following:
class RenameSeasonToSeasonId < ActiveRecord::Migration
def change
end
end
Modify it as follows:
class RenameSeasonToSeasonId < ActiveRecord::Migration
def change
rename_column :shoes, :season, :season_id
end
end
Then run $ rake db:migrate
in console.