Skip to content

Commit

Permalink
Allow emoji's in Comments
Browse files Browse the repository at this point in the history
- Prevents error from being thrown when someone uses an emoji in a Comment
- Changes Comments table charset and collation
- Delivers #2077
  • Loading branch information
JoeCohen committed Oct 8, 2024
1 parent 09d1cbd commit 948eb3f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
13 changes: 13 additions & 0 deletions db/migrate/20241008214055_change_comments_charset_and_collation.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class ChangeCommentsCharsetAndCollation < ActiveRecord::Migration[7.1]
def up
execute <<-SQL
ALTER TABLE comments CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;
SQL
end

def down
execute <<-SQL
ALTER TABLE comments CONVERT TO CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci;
SQL
end
end
6 changes: 3 additions & 3 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.1].define(version: 2024_10_01_233907) do
ActiveRecord::Schema[7.1].define(version: 2024_10_08_214055) do
create_table "api_keys", id: :integer, charset: "utf8mb3", force: :cascade do |t|
t.datetime "created_at", precision: nil
t.datetime "last_used", precision: nil
Expand Down Expand Up @@ -38,11 +38,11 @@
t.string "number"
end

create_table "comments", id: :integer, charset: "utf8mb3", force: :cascade do |t|
create_table "comments", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.datetime "created_at", precision: nil
t.integer "user_id"
t.string "summary", limit: 100
t.text "comment"
t.text "comment", size: :medium
t.string "target_type", limit: 30
t.integer "target_id"
t.datetime "updated_at", precision: nil
Expand Down

0 comments on commit 948eb3f

Please sign in to comment.