Answers for "in a migration how do you change a column name? * rails"

3

how to I change the name of a column in rails

$ rails g migration rename_season_to_season_id

class RenameSeasonToSeasonId < ActiveRecord::Migration
  def change
    rename_column :shoes, :season, :season_id
  end
end
Posted by: Guest on February-14-2020
0

rails migration change type of column

change_column :table_name, :column_name, :date
Posted by: Guest on May-11-2021

Code answers related to "in a migration how do you change a column name? * rails"

Browse Popular Code Answers by Language