Skip to content

Commit

Permalink
fix: add charset to table definitions (hschne#150)
Browse files Browse the repository at this point in the history
For any databases that do not have utf8 as the default. Without this
setting the tables are created with the default, but are treated as
utf8 which can result in errors:

   ERROR 1366 (HY000): Incorrect string value: '\xE2\x84\xAF\x0A -...' for column 'response_body' at row 1
  • Loading branch information
andynu authored Jun 10, 2022
1 parent c7cc56b commit 1dab8a8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions db/migrate/20210621185018_create_rmp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class CreateRmp < ActiveRecord::Migration[6.0]
def change
create_table :rmp_profiled_requests do |t|
create_table :rmp_profiled_requests, charset: 'utf8' do |t|
t.string :user_id
t.bigint :start
t.bigint :finish
Expand All @@ -23,7 +23,7 @@ def change
t.index :created_at
end

create_table :rmp_traces do |t|
create_table :rmp_traces, charset: 'utf8' do |t|
t.belongs_to :rmp_profiled_request, null: false, foreign_key: true
t.string :name
t.bigint :start
Expand All @@ -36,7 +36,7 @@ def change
t.timestamps
end

create_table :rmp_flamegraphs do |t|
create_table :rmp_flamegraphs, charset: 'utf8' do |t|
t.belongs_to :rmp_profiled_request, null: false, foreign_key: true
t.binary :data

Expand Down

0 comments on commit 1dab8a8

Please sign in to comment.