I've recently deployed my app to Heroku and in doing so I had to make some amends to a couple of columns in one of my tables. Specifically, I did the following:
class ChangeCancelColumnOrders < ActiveRecord::Migration
def change
change_column :orders, :cancel, 'boolean USING CAST(cancel AS boolean)'
end
end
I.E. I added the 'boolean USING CAST(cancel AS boolean)'
part because when trying to do a heroku run rake db:migrate
it was giving this error:
PG::DatatypeMismatch: ERROR: column "cancel" cannot be cast automatically to type boolean
This has been fixed and everything works fine on Heroku.
Now the problem is that when I attempt to run rake db:migrate
locally, I get the following error:
SQLite3::SQLException: near "USING": syntax error:
CREATE TABLE "orders" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime, "updated_at" datetime, "first_name" varchar(255), "last_name" varchar(255), "email" varchar(255), "address_1" varchar(255), "address_2" varchar(255), "city" varchar(255), "postal_code" varchar(255), "country_code" varchar(255), "shipped_date" date, "total_price" integer, "shipped" boolean DEFAULT 'f', "cancel" boolean USING CAST(cancel AS boolean) DEFAULT 'f', "cancel_date" date)
I can see that boolean USING CAST(cancel AS boolean)
has been added to the cancel
column but I don't know how to go about resolving this?