|
|
|
@ -14,12 +14,20 @@ module ReportingEngine |
|
|
|
|
connection = ActiveRecord::Base.connection |
|
|
|
|
adapter_name = connection.adapter_name.to_s.downcase.to_sym |
|
|
|
|
if [:mysql, :mysql2].include?(adapter_name) |
|
|
|
|
# The reporting engine is incompatible with the |
|
|
|
|
# following mysql versions due to a bug in MySQL itself: |
|
|
|
|
# 5.6.0 - 5.6.12 |
|
|
|
|
# 5.7.0 - 5.7.1 |
|
|
|
|
# see https://www.openproject.org/issues/967 for details. |
|
|
|
|
required_patch_levels = { "5.6" => 13, "5.7" => 2 } |
|
|
|
|
|
|
|
|
|
mysql_version = connection.show_variable("VERSION") |
|
|
|
|
if mysql_version.start_with?("5.6") |
|
|
|
|
# The reporting engine is not compatible with mysql version 5.6 |
|
|
|
|
# due to a bug in MySQL itself. |
|
|
|
|
# see https://www.openproject.org/issues/967 for details. |
|
|
|
|
raise "MySQL 5.6 is not yet supported." |
|
|
|
|
release_version, patch_level = mysql_version.match(/(\d*\.\d*)\.(\d*)/).captures |
|
|
|
|
required_patch_level = required_patch_levels[release_version] |
|
|
|
|
|
|
|
|
|
if required_patch_level && (patch_level.to_i < required_patch_level) |
|
|
|
|
raise "MySQL #{mysql_version} is not supported. Version #{release_version} \ |
|
|
|
|
requires patch level >= #{required_patch_level}." |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|