Sha256: b44f353dfb6d78bd1ef852d6be77b2bde35decce1b7a09614eac9d5f63f3c8e8

Contents?: true

Size: 834 Bytes

Versions: 1

Compression:

Stored size: 834 Bytes

Contents

# frozen_string_literal: true

# Only applicable for MySQL
if ActiveRecord::Base.connection_config[:adapter] == 'mysql2'
  # Get the configured encoding
  configured_encoding = ActiveRecord::Base.connection_config[:encoding]

  # Get the actual character set from the DB
  database_charset = ActiveRecord::Base.connection.exec_query('SELECT @@character_set_database as charset').first['charset']

  msg = <<~LOG
    WARNING: The configured db encoding `#{configured_encoding}` is different from the actual one `#{database_charset}`!
             This is likely to cause issues with special characters.
             Please see https://maestrano.atlassian.net/wiki/x/rQ0nBg or run:
               $ rails g connector:charset_migration
  LOG

  if configured_encoding != database_charset
    Rails.logger.warn msg
    warn msg
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
maestrano-connector-rails-2.3.6 config/initializers/db_encoding.rb