Sergio Xalambrí

How to rename a column in a Rails migration

If, for some reason, you need to rename a column in a table you need to create a new migration and run this code:

rename_column :table, :original_name, :new_name

With this, after running the migration your schema.db will be updated to have the correct name and you can start using it in your codebase.