lib/sequel/extensions/schema_caching.rb in sequel-5.5.0 vs lib/sequel/extensions/schema_caching.rb in sequel-5.6.0
- old
+ new
@@ -49,11 +49,19 @@
#
module Sequel
module SchemaCaching
# Dump the cached schema to the filename given in Marshal format.
def dump_schema_cache(file)
- File.open(file, 'wb'){|f| f.write(Marshal.dump(@schemas))}
+ sch = {}
+ @schemas.each do |k,v|
+ sch[k] = v.map do |c, h|
+ h = Hash[h]
+ h.delete(:callable_default)
+ [c, h]
+ end
+ end
+ File.open(file, 'wb'){|f| f.write(Marshal.dump(sch))}
nil
end
# Dump the cached schema to the filename given unless the file
# already exists.
@@ -63,9 +71,10 @@
# Replace the schema cache with the data from the given file, which
# should be in Marshal format.
def load_schema_cache(file)
@schemas = Marshal.load(File.read(file))
+ @schemas.each_value{|v| schema_post_process(v)}
nil
end
# Replace the schema cache with the data from the given file if the
# file exists.