Module: Earth::Warnings

Defined in:
lib/earth/warnings.rb

Class Method Summary collapse

Class Method Details

.check_mysql_ansi_modeObject



3
4
5
6
7
8
9
10
# File 'lib/earth/warnings.rb', line 3

def Warnings.check_mysql_ansi_mode
  if ::ActiveRecord::Base.connection.adapter_name =~ /mysql/i
    sql_mode = ::ActiveRecord::Base.connection.select_value("SELECT @@GLOBAL.sql_mode") + ::ActiveRecord::Base.connection.select_value("SELECT @@SESSION.sql_mode")
    unless sql_mode.downcase.include? 'pipes_as_concat'
      ::Kernel.warn "[earth gem] Warning: MySQL detected, but PIPES_AS_CONCAT not set. Importing from scratch will fail. Consider setting sql-mode=ANSI in my.cnf."
    end
  end
end