Class: OkComputer::ActiveRecordCheck

Inherits:
Check
  • Object
show all
Defined in:
lib/ok_computer/built_in_checks/active_record_check.rb

Constant Summary collapse

ConnectionFailed =
Class.new(StandardError)

Constants inherited from Check

Check::CheckNotDefined

Instance Attribute Summary

Attributes inherited from Check

#failure_occurred, #message, #registrant_name, #time

Instance Method Summary collapse

Methods inherited from Check

#<=>, #clear, #mark_failure, #mark_message, #run, #success?, #to_json, #to_text, #with_benchmarking

Instance Method Details

#checkObject

Public: Return the schema version of the database



4
5
6
7
8
9
# File 'lib/ok_computer/built_in_checks/active_record_check.rb', line 4

def check
  mark_message "Schema version: #{schema_version}"
rescue ConnectionFailed => e
  mark_failure
  mark_message "Error: '#{e}'"
end

#schema_versionObject

Public: The scema version of the app’s database

Returns a String with the version number



14
15
16
17
18
# File 'lib/ok_computer/built_in_checks/active_record_check.rb', line 14

def schema_version
  ActiveRecord::Migrator.current_version
rescue => e
  raise ConnectionFailed, e
end