jam-cloud/ruby/lib/jam_ruby/db_util.rb

26 lines
693 B
Ruby

module JamRuby
class DbUtil
def self.create(connection_hash)
end
BAD_CONN_EXCEPTIONS = [PG::UnableToSend, PG::ConnectionBad]
def self.bad_conn_exception?(exception)
test_exception = exception
if exception.class == ActiveRecord::StatementInvalid
test_exception = exception.original_exception
end
BAD_CONN_EXCEPTIONS.include?(test_exception.class)
end
def self.migrations_path
if ENV['RAILS_ENV'] == 'production'
"/var/lib/jam-web/vendor/bundle/ruby/2.3.0/gems/jam_ruby-0.1.#{ENV['BUILD_NUMBER']}/db/migrate"
else
File.expand_path("../../../../../db/migrate", __FILE__)
end
end
end
end