fix(messages): migrate message bodys to richtext

This commit is contained in:
Philipp Rothmann 2023-02-15 09:59:02 +01:00
parent 8eda266340
commit c24904fbe3
2 changed files with 11 additions and 2 deletions

View file

@ -0,0 +1,10 @@
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

View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2023_02_09_105256) do
ActiveRecord::Schema[7.0].define(version: 2023_02_15_085312) do
create_table "action_text_rich_texts", charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t|
t.string "name", null: false
t.text "body", size: :long
@ -292,7 +292,6 @@ ActiveRecord::Schema[7.0].define(version: 2023_02_09_105256) do
create_table "messages", id: :integer, charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t|
t.integer "sender_id"
t.string "subject", null: false
t.text "body"
t.boolean "private", default: false
t.datetime "created_at", precision: nil
t.integer "reply_to"