Module: Foreigner::SchemaDumper

Extended by:
ActiveSupport::Concern
Defined in:
lib/foreigner/schema_dumper.rb

Instance Method Summary collapse

Instance Method Details

#tables_with_foreign_keys(stream) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/foreigner/schema_dumper.rb', line 9

def tables_with_foreign_keys(stream)
  tables_without_foreign_keys(stream)
  @connection.tables.sort.each do |table|
    next if ['schema_migrations', ignore_tables].flatten.any? do |ignored|
      case ignored
      when String; table == ignored
      when Regexp; table =~ ignored
      else
        raise StandardError, 'ActiveRecord::SchemaDumper.ignore_tables accepts an array of String and / or Regexp values.'
      end
    end
    foreign_keys(table, stream)
  end
end