I was moving my app from Nitrous.io which uses SQLite to Heroku for production which uses Postgres, and I got the following error. 2 things, I don't get why it won't do change_column, and I definitely don't understand their "hint". How can I go about implementing properly?
-- change_column(:messages, :sender, :integer)
PG::DatatypeMismatch: ERROR: column "sender" cannot be cast automatically to type integer
HINT: Specify a USING expression to perform the conversion.
: ALTER TABLE "messages" ALTER COLUMN "sender" TYPE integer
The attributes were strings, and I wanted to change to integers so I could reference them. Any help? Below is my db migration that it is referencing:
class ChangeSenderReceiverToInteger < ActiveRecord::Migration
def change
change_column(:messages, :sender, :integer)
change_column(:messages, :receiver, :integer)
end
end