Module: DBuddy

Defined in:
lib/dbuddy.rb,
lib/dbuddy/version.rb

Constant Summary collapse

VERSION =
"0.2.0"

Class Method Summary collapse

Class Method Details

.run(connection, *paths) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/dbuddy.rb', line 12

def self.run(connection, *paths)
  connection.reconnect!
  ActiveRecord::Base.connection.allow_multi_statements!

  paths.each do |path|
    puts "Processing #{path}"
    begin
      connection.execute(File.read(path), "DBuddy: Reloading #{path}")
      puts "Done"
    rescue => e
      puts "Caught error"
      puts e.message
      puts e.backtrace
    end
  end
end