mirror of
https://github.com/meineerde/redmine.git
synced 2026-01-31 11:37:14 +00:00
Use tx_isolation for MySQL lower than 8. (#39437).
git-svn-id: https://svn.redmine.org/redmine/trunk@22464 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
0a329dce2f
commit
f24631a8bd
@ -61,6 +61,10 @@ module Redmine
|
||||
/mysql/i.match?(ActiveRecord::Base.connection.adapter_name)
|
||||
end
|
||||
|
||||
def mysql_version
|
||||
mysql? ? ActiveRecord::Base.connection.select_value("SELECT VERSION()") : nil
|
||||
end
|
||||
|
||||
# Returns a SQL statement for case/accent (if possible) insensitive match
|
||||
def like(left, right, options={})
|
||||
neg = (options[:match] == false ? 'NOT ' : '')
|
||||
|
||||
@ -203,6 +203,10 @@ class ActiveSupport::TestCase
|
||||
Redmine::Database.mysql?
|
||||
end
|
||||
|
||||
def mysql8?
|
||||
Gem::Version.new(Redmine::Database.mysql_version) >= Gem::Version.new('8.0.0')
|
||||
end
|
||||
|
||||
def postgresql?
|
||||
Redmine::Database.postgresql?
|
||||
end
|
||||
|
||||
@ -32,7 +32,7 @@ class IssueNestedSetConcurrencyTest < ActiveSupport::TestCase
|
||||
skip if sqlite?
|
||||
if mysql?
|
||||
connection = ActiveRecord::Base.connection_db_config.configuration_hash.deep_dup
|
||||
connection[:variables] = { transaction_isolation: "READ-COMMITTED" }
|
||||
connection[:variables] = mysql8? ? { transaction_isolation: "READ-COMMITTED" } : { tx_isolation: "READ-COMMITTED" }
|
||||
ActiveRecord::Base.establish_connection connection
|
||||
end
|
||||
User.current = nil
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user