memo.xight.org

日々のメモ

Railsでカラム名の変更

Terminal

rails generate migration fix_typo


db/migrate/XXXXXXXXXXXXXXXX_fix_typo.rb

class ChangeColumnModelName < ActiveRecord::Migration[5.0]
  def change
	rename_column :modelname, :wrong, :correct
  end
end

Terminal

rake db:migrate