Class: Banana::MultidbSchemaDumper

Inherits:
ActiveRecord::SchemaDumper
  • Object
show all
Defined in:
lib/banana/multidb_schema_dumper.rb

Class Method Summary collapse

Class Method Details

.dump_multidb(specs = [], stream = STDOUT) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/banana/multidb_schema_dumper.rb', line 7

def self.dump_multidb(specs=[], stream=STDOUT)
  specs.each_with_index do |spec, index|
    ActiveRecord::Base.establish_connection(spec)
    dumper = new(ActiveRecord::Base.connection)
    dumper.header(stream) if index == 0
    dumper.tables(stream)
    dumper.trailer(stream) if index == specs.count - 1
  end
  stream
end