Answers for "rename column in db rails"

2

active record modify column name

rename_column :table, :old_column, :new_column
Posted by: Guest on November-11-2020
1

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
Posted by: Guest on December-17-2020
2

rename column in db rails

rails generate migration rename_title_to_name_in_tasks
Posted by: Guest on December-17-2020

Browse Popular Code Answers by Language