summaryrefslogtreecommitdiff
path: root/config/initializers/mysql_modern_column_type_defaults.rb
blob: 1a8e41113d7301106a93397e569109f2e2cfa8d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
require 'active_record/connection_adapters/abstract_mysql_adapter'

ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter::NATIVE_DATABASE_TYPES.tap do |defaults|
  # Decrease default string length from 255 -> 191 chars so *_type columns
  # can be indexed with utf8mb4 without blowing 767 byte max key length.
  defaults[:string][:limit] = 191
end


# thanks @jeremy
# https://github.com/rails/rails/pull/23009#issuecomment-171406595