diff --git a/lib/schema_plus/core/schema_dump.rb b/lib/schema_plus/core/schema_dump.rb index e4c0db2..65f5889 100644 --- a/lib/schema_plus/core/schema_dump.rb +++ b/lib/schema_plus/core/schema_dump.rb @@ -105,6 +105,13 @@ def assemble(stream, typelen, namelen) pr += ',' unless options.blank? stream.write "%-#{namelen+3}s " % pr end + if Gem::Version.new(::ActiveRecord::VERSION::STRING) >= Gem::Version.new('5.0.0') + if options[:default].is_a?(Proc) && + default = options.delete(:default) + stream.write "default: -> { \"#{default.call}\" }" + stream.write ", " unless options.blank? + end + end stream.write options.to_s.sub(/^{(.*)}$/, '\1') unless options.blank? stream.write ' ' unless options.blank? or comments.blank? stream.write '# ' + comments.join('; ') unless comments.blank?