lib/wyrm/dump_schema.rb in wyrm-0.1.3 vs lib/wyrm/dump_schema.rb in wyrm-0.1.4

- old
+ new

@@ -82,11 +82,11 @@ (container + '003_indexes.rb').open('w') do |io| io.write index_migration end - (container + '004_foreign keys.rb').open('w') do |io| + (container + '004_foreign_keys.rb').open('w') do |io| io.write fk_migration end end def open_bz2( pathname ) @@ -113,18 +113,24 @@ ensure zio.close unless zio.closed? fio.close unless fio.closed? end + def dump_table( table_name ) + filename = container + "#{table_name}.dbp.bz2" + logger.info "dumping #{table_name} to #{filename}" + open_bz2 filename do |zio| + # generate the dump + pump.table_name = table_name + pump.io = zio + pump.dump + end + rescue + logger.error "failed dumping #{table_name}: #{$!.message}" + end + def dump_tables src_db.tables.each do |table_name| - filename = container + "#{table_name}.dbp.bz2" - logger.info "dumping #{table_name} to #{filename}" - open_bz2 filename do |zio| - # generate the dump - pump.table_name = table_name - pump.io = zio - pump.dump - end + dump_table table_name end end end