I've made a database and already inputted about 30-40 entries into the database but there was a mistake and I have accidentally set some columns of the database to be strings when I need them to be decimals in order to perform operations on them.
In order to change the database I have generated a migration file that includes this.
class ChangeOddsAndUnitsColumn < ActiveRecord::Migration
def change
change_column :bets, :units_placed, :decimal
change_column :bets, :odds, :decimal
end
end
However when I run rake db:migrate I get the following error
PG::DatatypeMismatch: ERROR: column "units_placed" cannot be cast automatically to type numeric
The values in each column are already decimal numbers but I can't figure out how to convert them to the decimal type from a string.