Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

How can I rename a database column in a Ruby on Rails migration?

rails generate migration rename_title_to_name_in_tasks

class RenameTitleToNameInTasks < ActiveRecord::Migration[6.0]
  def change
    rename_column :tasks, :title, :name
  end
end
 
PREVIOUS NEXT
Tagged: #How #I #rename #database #column #Ruby #Rails
ADD COMMENT
Topic
Name
2+4 =