2015-10-24 18:46:33 +05:30
|
|
|
module Gitlab
|
|
|
|
module Database
|
|
|
|
def self.mysql?
|
2015-11-26 14:37:03 +05:30
|
|
|
ActiveRecord::Base.connection.adapter_name.downcase == 'mysql2'
|
2015-10-24 18:46:33 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def self.postgresql?
|
|
|
|
ActiveRecord::Base.connection.adapter_name.downcase == 'postgresql'
|
|
|
|
end
|
2015-12-23 02:04:40 +05:30
|
|
|
|
|
|
|
def true_value
|
|
|
|
case ActiveRecord::Base.connection.adapter_name.downcase
|
|
|
|
when 'postgresql'
|
|
|
|
"'t'"
|
|
|
|
else
|
|
|
|
1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def false_value
|
|
|
|
case ActiveRecord::Base.connection.adapter_name.downcase
|
|
|
|
when 'postgresql'
|
|
|
|
"'f'"
|
|
|
|
else
|
|
|
|
0
|
|
|
|
end
|
|
|
|
end
|
2015-10-24 18:46:33 +05:30
|
|
|
end
|
|
|
|
end
|