I have this table:
class CreateShoes < ActiveRecord::Migration
def change
create_table :shoes do |t|
t.string :name
t.boolean :leather
If your branch has been pushed to production then one probably needs to add the new migration by running the following command:
rails g migration RenameSeasonColumnNameToShoes
and if it hasn't been pushed to production or you have to currently make changes to your branch only, then do:
bundle exec rake db:rollback
Then make changes to your migration file inside /db/migrate/
Then in your migration file, using rename_column
do as follows:
class RenameSeasonColumnNameToShoes < ActiveRecord::Migration
def change
rename_column :shoes, :season, :season_id
end
end
and then do
bundle exec rake db:migrate db:test:prepare