From 65f2eeaaf5774f0891fff700f4defb0b90a05789 Mon Sep 17 00:00:00 2001 From: Kasper Timm Hansen Date: Tue, 12 Mar 2019 22:26:45 +0100 Subject: Remove Marshal support from SchemaCache YAML has been used to serialize the schema cache ever since 2016 with Rails 5.1: 4c00c6ed --- .../active_record/connection_adapters/schema_cache.rb | 10 ---------- .../test/cases/connection_adapters/schema_cache_test.rb | 16 ---------------- 2 files changed, 26 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/connection_adapters/schema_cache.rb b/activerecord/lib/active_record/connection_adapters/schema_cache.rb index c10765f42d..fd7de1ccf2 100644 --- a/activerecord/lib/active_record/connection_adapters/schema_cache.rb +++ b/activerecord/lib/active_record/connection_adapters/schema_cache.rb @@ -103,16 +103,6 @@ module ActiveRecord @data_sources.delete name end - def marshal_dump - # if we get current version during initialization, it happens stack over flow. - @version = connection.migration_context.current_version - [@version, @columns, @columns_hash, @primary_keys, @data_sources] - end - - def marshal_load(array) - @version, @columns, @columns_hash, @primary_keys, @data_sources = array - end - private def prepare_data_sources diff --git a/activerecord/test/cases/connection_adapters/schema_cache_test.rb b/activerecord/test/cases/connection_adapters/schema_cache_test.rb index 727cab77f5..79067c0f8a 100644 --- a/activerecord/test/cases/connection_adapters/schema_cache_test.rb +++ b/activerecord/test/cases/connection_adapters/schema_cache_test.rb @@ -66,22 +66,6 @@ module ActiveRecord assert_equal 0, @cache.size end - def test_dump_and_load - @cache.columns("posts") - @cache.columns_hash("posts") - @cache.data_sources("posts") - @cache.primary_keys("posts") - - @cache = Marshal.load(Marshal.dump(@cache)) - - assert_no_queries do - assert_equal 12, @cache.columns("posts").size - assert_equal 12, @cache.columns_hash("posts").size - assert @cache.data_sources("posts") - assert_equal "id", @cache.primary_keys("posts") - end - end - def test_data_source_exist assert @cache.data_source_exists?("posts") assert_not @cache.data_source_exists?("foo") -- cgit v1.2.3