rails migrations rename columns code example
Example 1: active record modify column name
rename_column :table, :old_column, :new_column
Example 2: rename column in db rails
class RenameTitleToNameInTasks < ActiveRecord::Migration[6.0]
def up
rename_column :tasks, :title, :name
end
def down
rename_column :tasks, :name, :title
end
end