Class: Fettle::Checks::ActiveRecordCheck
- Inherits:
-
Object
- Object
- Fettle::Checks::ActiveRecordCheck
- Defined in:
- lib/fettle/checks/active_record_check.rb
Class Method Summary collapse
Class Method Details
.call ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/fettle/checks/active_record_check.rb', line 7 def call return true unless defined?(ActiveRecord) check_connection! check_migrations! true end |
.check_connection! ⇒ Object
16 17 18 19 20 21 |
# File 'lib/fettle/checks/active_record_check.rb', line 16 def check_connection! ActiveRecord::Base.connection ActiveRecord::Base.connected? || raise(FailedCheck, 'Failed to establish database connection') end |
.check_migrations! ⇒ Object
23 24 25 26 27 |
# File 'lib/fettle/checks/active_record_check.rb', line 23 def check_migrations! ActiveRecord::Migration.check_pending! rescue raise(FailedCheck, 'Database migrations are pending') end |