Sha256: 8a4bf535899558f0139b804990845b8ec83791eae5676fe03fb1ac1ab1fe4a00

Contents?: true

Size: 530 Bytes

Versions: 2

Compression:

Stored size: 530 Bytes

Contents

# Creates DATETIME(6) column types by default which support microseconds.
#
# Without it, only regular (second precise) DATETIME columns are created.
if defined?(ActiveRecord)
  module ActiveRecord::ConnectionAdapters
    if ActiveRecord::Base.connection.instance_of? Mysql2Adapter
      version = Gem::Version.new(Mysql2::Client.info.fetch(:version))
      min_vresion = Gem::Version.new('5.6.4')
      if version>=min_vresion
        AbstractMysqlAdapter::NATIVE_DATABASE_TYPES[:datetime][:limit] = 6
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kono_utils-0.15.10 config/initializers/mysql.rb
kono_utils-0.15.9 config/initializers/mysql.rb