1

I experienced this error when I tried to run rake db:migrate. rake aborted! StandardError: An error has occurred, this and all later migrations canceled:

PG::DatatypeMismatch: ERROR: column "developer_id" cannot be cast automatically to type integer HINT: You might need to specify "USING developer_id::integer".

I am changing my sqlite3 database to PostgreSQL for deployment in Heroku. I am assuming the error is coming from the db/migrate file.rb that has the developer_id column specified.

  def change
    change_column :entries, :developer_id, :integer
  end
end

I will add any other document that may help locate the problem.

  • 1) What is the type for `developer_id` in SQLite? 2) What is actually stored in the field in SQLite? In SQLite it is possible to store mixed types in a column as it does not enforce the type, unless you specified [Strict](https://sqlite.org/stricttables.html). **Add information as update to question**. – Adrian Klaver Sep 10 '22 at 15:39
  • Solved the issue. It seems I just had extra code with unnecessary code. i.e unnecesary code containing developer_id – Glenn Mwangi Sep 18 '22 at 21:18

0 Answers0