Sha256: d5513bf4c78a3930d68c4eb5b2e03214824042fad82a8371c9074820b0d7fbd4
Contents?: true
Size: 1.22 KB
Versions: 2
Compression:
Stored size: 1.22 KB
Contents
module ActiveRecordDoctor module Printers class IOPrinter def initialize(io: STDOUT) @io = io end def print_unindexed_foreign_keys(unindexed_foreign_keys) @io.puts(unindexed_foreign_keys.sort.map do |table, columns| "#{table} #{columns.sort.join(' ')}" end.join("\n")) end def print_extraneous_indexes(extraneous_indexes) if extraneous_indexes.empty? @io.puts("No indexes are extraneous.") else @io.puts("The following indexes are extraneous and can be removed:") extraneous_indexes.each do |index, details| reason, *params = details case reason when :multi_column @io.puts(" #{index} (can be handled by #{params.join(', ')})") when :primary_key @io.puts(" #{index} (is a primary key of #{params[0]})") else fail("unknown reason #{reason.inspect}") end end end end def print_missing_foreign_keys(missing_foreign_keys) @io.puts(missing_foreign_keys.sort.map do |table, columns| "#{table} #{columns.sort.join(' ')}" end.join("\n")) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
active_record_doctor-1.3.1 | lib/active_record_doctor/printers/io_printer.rb |
active_record_doctor-1.3.0 | lib/active_record_doctor/printers/io_printer.rb |