foodsoft/db/migrate/20230215085312_migrate_message_body_to_action_text.rb
2023-02-22 16:59:50 +01:00

10 lines
331 B
Ruby

class MigrateMessageBodyToActionText < ActiveRecord::Migration[7.0]
include ActionView::Helpers::TextHelper
def change
rename_column :messages, :body, :body_old
Message.all.each do |message|
message.update_attribute(:body, simple_format(message.body_old))
end
remove_column :messages, :body_old
end
end