Module: Foreigner::SchemaDumper::InstanceMethods

Defined in:
lib/foreigner/schema_dumper.rb

Instance Method Summary collapse

Instance Method Details

#table_with_foreign_keys(table, stream) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/foreigner/schema_dumper.rb', line 21

def table_with_foreign_keys(table, stream)
  if @connection.class == ActiveRecord::ConnectionAdapters::SQLite3Adapter
    foreign_key_table(table, stream)
  else
    table_without_foreign_keys(table, stream)
  end
end

#tables_with_foreign_keys(stream) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/foreigner/schema_dumper.rb', line 12

def tables_with_foreign_keys(stream)
  tables_without_foreign_keys(stream)
  if @connection.class != ActiveRecord::ConnectionAdapters::SQLite3Adapter
    @connection.tables.sort.each do |table|
      foreign_keys(table, stream)
    end
  end
end