I have two columns in one of my tables that I need to convert from a string to a boolean. The objects already have data attached to these columns (yes, no or nil) and so would need to convert the yes results to true and no/nil to false.
I am running a simple migration for change_column but that is clearly not the way to go and I am having trouble finding a solution.
My table is as follows and the two columns are inner_sleeve and inserts.
create_table "listings", force: :cascade do |t|
t.string "front_cover"
t.bigint "version_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "back_cover"
t.string "front_label"
t.string "back_label"
t.integer "step", default: 0
t.string "cover_conditions", default: [], array: true
t.string "cover_grading"
t.text "cover_info"
t.boolean "original_sleeve"
t.string "disc_grading"
t.text "disc_info"
t.string "inner_sleeve"
t.string "inserts"
t.text "inner_inserts_info"
t.text "other_info"
t.bigint "user_id"
t.string "disc_conditions", default: [], array: true
t.integer "status", default: 0
t.date "first_active_at"
t.boolean "order_dispatched", default: false
t.bigint "purchaser_id"
t.index ["purchaser_id"], name: "index_listings_on_purchaser_id"
t.index ["user_id"], name: "index_listings_on_user_id"
t.index ["version_id"], name: "index_listings_on_version_id"
end
Thank you!