Sha256: 55f09d787596fdac10076ce636d3a99f8a831733855b262d9e25abc4e7697ed5

Contents?: true

Size: 687 Bytes

Versions: 1

Compression:

Stored size: 687 Bytes

Contents

# frozen_string_literal: true

module ActiveRecordDoctor
  module Utils # :nodoc:
    class << self
      def postgresql?(connection = ActiveRecord::Base.connection)
        ["PostgreSQL", "PostGIS"].include?(connection.adapter_name)
      end

      def mysql?(connection = ActiveRecord::Base.connection)
        connection.adapter_name == "Mysql2"
      end

      def expression_indexes_unsupported?(connection = ActiveRecord::Base.connection)
        (ActiveRecord::VERSION::STRING < "5.0") ||
          # Active Record < 6 is unable to correctly parse expression indexes for MySQL.
          (mysql?(connection) && ActiveRecord::VERSION::STRING < "6.0")
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active_record_doctor-1.12.0 lib/active_record_doctor/utils.rb