Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #5464: patch-updated.diff

File patch-updated.diff, 1.2 kB (added by mail@matthewpainter.co.uk, 2 years ago)

Updated patch to allow for double quotes in type

  • activerecord/lib/active_record/schema_dumper.rb

    old new  
    8585          tbl.puts " do |t|" 
    8686 
    8787          column_specs = columns.map do |column| 
    88             raise StandardError, "Unknown type '#{column.sql_type}' for column '#{column.name}'" if @types[column.type].nil? 
    8988            next if column.name == pk 
    9089            spec = {} 
    9190            spec[:name]    = column.name.inspect 
    92             spec[:type]    = column.type.inspect 
    93             spec[:limit]   = column.limit.inspect if column.limit != @types[column.type][:limit]  
     91            spec[:type]    = @types[column.type].nil? ? '"'+(column.sql_type.gsub(/"/, '\"'))+'"' : column.type.inspect 
     92            spec[:limit]   = column.limit.inspect if !@types[column.type].nil? && column.limit != @types[column.type][:limit]  
    9493            spec[:default] = column.default.inspect if !column.default.nil? 
    9594            spec[:null]    = 'false' if !column.null 
    9695            (spec.keys - [:name, :type]).each{ |k| spec[k].insert(0, "#{k.inspect} => ")}