Module: DatabasePatcher::DB
Instance Method Summary collapse
Instance Method Details
#create_connection ⇒ Object
8 9 10 11 12 13 |
# File 'lib/database_patcher/db.rb', line 8 def create_connection new_connection = Sequel.connect(DatabasePatcher::Environment.database_url) new_connection.sql_log_level = :info new_connection.loggers << new_logger new_connection end |
#new_logger ⇒ Object
15 16 17 18 19 |
# File 'lib/database_patcher/db.rb', line 15 def new_logger logger = Logger.new($stdout) logger.level = Logger::Severity::ERROR logger end |
#valid_connection?(connection) ⇒ Boolean
21 22 23 24 25 |
# File 'lib/database_patcher/db.rb', line 21 def valid_connection?(connection) !connection.nil? && connection.test_connection rescue false end |