Sha256: e03cd52bfff9a0e7ad53a59fb20a9390cf8869cd18231abcf475ada19b418255

Contents?: true

Size: 507 Bytes

Versions: 3

Compression:

Stored size: 507 Bytes

Contents

require "active_record_doctor/tasks/base"

module ActiveRecordDoctor
  module Tasks
    class UnindexedDeletedAt < Base
      def run
        success(connection.tables.select do |table|
          connection.columns(table).map(&:name).include?('deleted_at')
        end.flat_map do |table|
          connection.indexes(table).reject do |index|
            index.where =~ /\bdeleted_at\s+IS\s+NULL\b/i
          end.map do |index|
            index.name
          end
        end)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
active_record_doctor-1.7.1 lib/active_record_doctor/tasks/unindexed_deleted_at.rb
active_record_doctor-1.7.0 lib/active_record_doctor/tasks/unindexed_deleted_at.rb
active_record_doctor-1.6.0 lib/active_record_doctor/tasks/unindexed_deleted_at.rb