I changed a column in my DB like so:
class ChangeTestTypeInScores < ActiveRecord::Migration
def self.up
change_column :scores, :test_type, :boolean
end
def self.down
change_column :scores, :test_type, :string
end
end
It works fine, but when I pushed to heroku and Heroku run rake db: migrate, I get the following error:
PG::DatatypeMismatch: ERROR: column "test_type" cannot be cast automatically to type boolean
HINT: Specify a USING expression to perform the conversion.
: ALTER TABLE "scores" ALTER COLUMN "test_type" TYPE boolean
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
How would I go about correcting this now that I've already updated my local DB?
change_column :scores, :test_type, 'boolean USING CAST(column_name AS boolean)'