Ruby on Rails Migration Cheat Sheet
Change a database column from string to decimal
rails g migration
change_tfi_to_string_in_master_grants
class change_tfi_to_decimal_in_MasterGrants < ActiveRecord::Migration[7.1]
def change
execute """
alter table master_grants alter column total_funding_investment type decimal using (total_funding_investment::numeric)
"""
end
end
New Comment