aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters/mysql2
diff options
context:
space:
mode:
authorAli Ibrahim <aibrahim2k2@gmail.com>2019-03-29 11:18:48 -0400
committerAli Ibrahim <aibrahim2k2@gmail.com>2019-04-03 11:10:14 -0400
commit1c6e508ade793b5f2676e9218ab2f4cc9474f9ce (patch)
treed890ba17fd2abdb8fee40b3e4dd04259a79613cc /activerecord/test/cases/adapters/mysql2
parentbeb0bc9907a31d0cbd2ca68c79c57a9e375761e8 (diff)
downloadrails-1c6e508ade793b5f2676e9218ab2f4cc9474f9ce.tar.gz
rails-1c6e508ade793b5f2676e9218ab2f4cc9474f9ce.tar.bz2
rails-1c6e508ade793b5f2676e9218ab2f4cc9474f9ce.zip
Cache database version in schema cache
* The database version will get cached in the schema cache file during the schema cache dump. When the database version check happens, the version will be pulled from the schema cache and thus avoid querying the database for the version. * If the schema cache file doesn't exist, we'll query the database for the version and cache it on the schema cache object. * To facilitate this change, all connection adapters now implement #get_database_version and #database_version. #database_version returns the value from the schema cache. * To take advantage of the cached database version, the database version check will now happen after the schema cache is set on the connection in the connection pool.
Diffstat (limited to 'activerecord/test/cases/adapters/mysql2')
-rw-r--r--activerecord/test/cases/adapters/mysql2/datetime_precision_quoting_test.rb3
-rw-r--r--activerecord/test/cases/adapters/mysql2/sp_test.rb2
2 files changed, 1 insertions, 4 deletions
diff --git a/activerecord/test/cases/adapters/mysql2/datetime_precision_quoting_test.rb b/activerecord/test/cases/adapters/mysql2/datetime_precision_quoting_test.rb
index 00a075e063..cbe55f1d53 100644
--- a/activerecord/test/cases/adapters/mysql2/datetime_precision_quoting_test.rb
+++ b/activerecord/test/cases/adapters/mysql2/datetime_precision_quoting_test.rb
@@ -46,10 +46,7 @@ class Mysql2DatetimePrecisionQuotingTest < ActiveRecord::Mysql2TestCase
def stub_version(full_version_string)
@connection.stub(:full_version, full_version_string) do
- @connection.remove_instance_variable(:@version) if @connection.instance_variable_defined?(:@version)
yield
end
- ensure
- @connection.remove_instance_variable(:@version) if @connection.instance_variable_defined?(:@version)
end
end
diff --git a/activerecord/test/cases/adapters/mysql2/sp_test.rb b/activerecord/test/cases/adapters/mysql2/sp_test.rb
index 7b6dce71e9..626ef59570 100644
--- a/activerecord/test/cases/adapters/mysql2/sp_test.rb
+++ b/activerecord/test/cases/adapters/mysql2/sp_test.rb
@@ -9,7 +9,7 @@ class Mysql2StoredProcedureTest < ActiveRecord::Mysql2TestCase
def setup
@connection = ActiveRecord::Base.connection
- unless ActiveRecord::Base.connection.version >= "5.6.0"
+ unless ActiveRecord::Base.connection.database_version >= "5.6.0"
skip("no stored procedure support")
end
end