module AuditRails::DBExtension

Public Instance Methods

adapter_type() click to toggle source
# File lib/audit_rails/db_extension.rb, line 3
def adapter_type
  connection.adapter_name.downcase.to_sym
end
hourly(column) click to toggle source
# File lib/audit_rails/db_extension.rb, line 7
def hourly(column)
  case adapter_type
  when :mysql, :mysql2
    "hour(#{column})"
  when :sqlite, :sqlite3
    "strftime('%H', #{column})"
  when :postgresql
    "DATE_PART('hour', #{column})"
  else
    raise NotImplementedError, "Unknown adapter type '#{adapter_type}'"
  end
end