Iโve already figured it out a bit and donโt see a satisfactory answer to my problem.
I have a table with a type row column. I want to do the following migration:
class ChangeColumnToBoolean < ActiveRecord::Migration def up change_column :users, :smoking, :boolean end end
When I run this, I get the following error
PG::Error: ERROR: column "smoking" cannot be cast automatically to type boolean HINT: Specify a USING expression to perform the conversion. : ALTER TABLE "users" ALTER COLUMN "smoking" TYPE boolean
I know that I can perform this migration using pure SQL, but it would still be better if I could do this with Rails. I went through the Rails code and doesn't seem to have that capability, but maybe someone knows a way?
I'm not interested in: - pure SQL - deleting a column - creating another column, transforming the data, deleting the original, and then renaming
ruby-on-rails ruby-on-rails-3
Mike Szyndel Jun 12 '13 at 20:54 on 2013-06-12 20:54
source share