Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/schema_plus/core/schema_dump.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down