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

Ticket #7424: decorate_mysql_blob_and_text_schema_dumps.diff

File decorate_mysql_blob_and_text_schema_dumps.diff, 1.1 kB (added by will.bryant, 2 years ago)

proposed patch

  • lib/active_record/connection_adapters/mysql_adapter.rb

    old new  
    101101          super 
    102102        end 
    103103 
     104        def extract_limit(sql_type) 
     105          if sql_type =~ /blob|text/i 
     106            case sql_type 
     107            when /tiny/i 
     108              255 
     109            when /medium/i 
     110              16777215 
     111            when /long/i 
     112              2147483647 # mysql only allows 2^31-1, not 2^32-1, somewhat inconsistently with the tiny/medium/normal cases 
     113            else 
     114              super # we could return 65535 here, but we leave it undecorated by default 
     115            end 
     116          else 
     117            super 
     118          end 
     119        end 
     120 
    104121        # MySQL misreports NOT NULL column default when none is given. 
    105122        # We can't detect this for columns which may have a legitimate '' 
    106123        # default (string) but we can for others (integer, datetime, boolean,