Problem
When I try to change a columns data type from boolean to integer I get an error from postgres about how the column cant automatically be cast to the type of integer.
Background
I have a model with the name Inquiry that has a column named flexible regarding if the person needs to have a flexible office situation or not. Initially it was a true/false, but with input from the client we now need to be able to have both as an option. Therefor I created a migration to change the data type of that column from boolean to integer so I can make use of enums to solve that issue.
Implementation code
This is how the migration file looks like
class ChangeDataTypeForFlexible < ActiveRecord::Migration[6.1]
def change
change_column :inquiries, :flexible, :integer
end
end
Screenshots

Problem
When I try to change a columns data type from
booleantointegerI get an error frompostgresabout how the column cant automatically be cast to the type of integer.Background
I have a model with the name
Inquirythat has a column namedflexibleregarding if the person needs to have a flexible office situation or not. Initially it was atrue/false, but with input from the client we now need to be able to havebothas an option. Therefor I created a migration to change the data type of that column frombooleantointegerso I can make use ofenumsto solve that issue.Implementation code
This is how the migration file looks like
Screenshots